Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not build with Cython 3 #211

Closed
musicinmybrain opened this issue Jul 20, 2023 · 2 comments · Fixed by #227
Closed

Does not build with Cython 3 #211

musicinmybrain opened this issue Jul 20, 2023 · 2 comments · Fixed by #227

Comments

@musicinmybrain
Copy link
Contributor

Cython 3.0.0 was just released (https://cython.readthedocs.io/en/latest/src/changes.html), and it looks like cyipopt will need some changes to be compatible with it.

python3 -m build
[...]
Compiling cyipopt/cython/ipopt_wrapper.pyx because it changed.
[1/1] Cythonizing cyipopt/cython/ipopt_wrapper.pyx
/tmp/build-env-9tlwx0y5/lib64/python3.11/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/build-via-sdist-_jz2qe4_/cyipopt-1.2.0.dev0/cyipopt/cython/ipopt_wrapper.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Error compiling Cython file:
------------------------------------------------------------
...
                                        <Number*>np_cl.data,
                                        <Number*>np_cu.data,
                                        nele_jac,
                                        nele_hess,
                                        0,
                                        objective_cb,
                                        ^
------------------------------------------------------------

cyipopt/cython/ipopt_wrapper.pyx:416:40: Cannot assign type 'Bool (Index, Number *, Bool, Number *, UserDataPtr) except? -1' to 'Eval_F_CB'

Error compiling Cython file:
------------------------------------------------------------
...
                                        <Number*>np_cu.data,
                                        nele_jac,
                                        nele_hess,
                                        0,
                                        objective_cb,
                                        constraints_cb,
                                        ^
------------------------------------------------------------

cyipopt/cython/ipopt_wrapper.pyx:417:40: Cannot assign type 'Bool (Index, Number *, Bool, Index, Number *, UserDataPtr) except? -1' to 'Eval_G_CB'

Error compiling Cython file:
------------------------------------------------------------
...
                                        nele_jac,
                                        nele_hess,
                                        0,
                                        objective_cb,
                                        constraints_cb,
                                        gradient_cb,
                                        ^
------------------------------------------------------------

cyipopt/cython/ipopt_wrapper.pyx:418:40: Cannot assign type 'Bool (Index, Number *, Bool, Number *, UserDataPtr) except? -1' to 'Eval_Grad_F_CB'

Error compiling Cython file:
------------------------------------------------------------
...
                                        nele_hess,
                                        0,
                                        objective_cb,
                                        constraints_cb,
                                        gradient_cb,
                                        jacobian_cb,
                                        ^
------------------------------------------------------------

cyipopt/cython/ipopt_wrapper.pyx:419:40: Cannot assign type 'Bool (Index, Number *, Bool, Index, Index, Index *, Index *, Number *, UserDataPtr) except? -1' to 'Eval_Jac_G_CB'

Error compiling Cython file:
------------------------------------------------------------
...
                                        0,
                                        objective_cb,
                                        constraints_cb,
                                        gradient_cb,
                                        jacobian_cb,
                                        hessian_cb
                                        ^
------------------------------------------------------------

cyipopt/cython/ipopt_wrapper.pyx:420:40: Cannot assign type 'Bool (Index, Number *, Bool, Number, Index, Number *, Bool, Index, Index *, Index *, Number *, UserDataPtr) except? -1' to 'Eval_H_CB'

Error compiling Cython file:
------------------------------------------------------------
...

        if self.__nlp == NULL:
            msg = "Failed to create NLP problem. Make sure inputs are okay!"
            raise RuntimeError(msg)

        SetIntermediateCallback(self.__nlp, intermediate_cb)
                                            ^
------------------------------------------------------------

cyipopt/cython/ipopt_wrapper.pyx:427:44: Cannot assign type 'Bool (Index, Index, Number, Number, Number, Number, Number, Number, Number, Number, Index, UserDataPtr) except? -1' to 'Intermediate_CB'
Traceback (most recent call last):
[...]
@musicinmybrain
Copy link
Contributor Author

For similar issues in other packages, see the section “Cannot assign type 'XXX (YYY) except? -1 nogil' to 'ZZZ *' (14 affected projects)” in cython/cython#5305.

@moorepants
Copy link
Collaborator

Info on migration: https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#exception-values-and-noexcept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants