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

Compilation error Python 3.10 #34

Open
quantumadventure opened this issue Aug 22, 2023 · 0 comments
Open

Compilation error Python 3.10 #34

quantumadventure opened this issue Aug 22, 2023 · 0 comments

Comments

@quantumadventure
Copy link

Hi,
I'm trying to compile ParOpt under pyenv with Python 3.10-dev. The compilation via make of the C-part is working fine. But when I run:

python3 setup.py install

I get:

Warning: passing language='c++' to cythonize() is deprecated. Instead, put "# distutils: language=c++" in your .pyx or .pxd file(s)
Compiling paropt/ParOpt.pyx because it changed.
Compiling paropt/ParOptEig.pyx because it changed.
[1/2] Cythonizing paropt/ParOpt.pyx
/.pyenv/versions/3.10-dev/lib/python3.10/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: /optimizer/py/paropt/paropt/ParOpt.pxd
  tree = Parsing.p_module(s, pxd, full_module_name)

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

# Import the string library
from libcpp.string cimport string

# Import the declarations required from the pxd file
from ParOpt cimport *
^
------------------------------------------------------------

paropt/ParOpt.pyx:16:0: 'ParOpt.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
    ndarray = np.PyArray_SimpleNewFromData(size, shape,
                                           nptype, data_ptr)

    if base is not None:
        Py_INCREF(base)
        ndarray.base = <PyObject*>base
               ^
------------------------------------------------------------

paropt/ParOpt.pyx:377:15: Assignment to a read-only property

Error compiling Cython file:
------------------------------------------------------------
...
        cdef MPI_Comm c_comm = comm.ob_mpi
        if nineq < 0:
            nineq = ncon
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
                                    ^
------------------------------------------------------------

paropt/ParOpt.pyx:750:36: Cannot assign type 'void (void *, int, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'getvarsandbounds'

Error compiling Cython file:
------------------------------------------------------------
...
        if nineq < 0:
            nineq = ncon
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
                              ^
------------------------------------------------------------

paropt/ParOpt.pyx:751:30: Cannot assign type 'int (void *, int, int, ParOptVec *, ParOptScalar *, ParOptScalar *) except? -1' to 'evalobjcon'

Error compiling Cython file:
------------------------------------------------------------
...
            nineq = ncon
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
                                      ^
------------------------------------------------------------

paropt/ParOpt.pyx:752:38: Cannot assign type 'int (void *, int, int, ParOptVec *, ParOptVec *, ParOptVec **) except? -1' to 'evalobjcongradient'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me = new CyParOptProblem(c_comm, nvars, ncon, nineq, nwcon, nwblock)
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
                                   ^
------------------------------------------------------------

paropt/ParOpt.pyx:753:35: Cannot assign type 'int (void *, int, int, int, ParOptVec *, ParOptScalar *, ParOptVec *, ParOptVec *, ParOptVec *) except? -1' to 'evalhvecproduct'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setSelfPointer(<void*>self)
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
                                   ^
------------------------------------------------------------

paropt/ParOpt.pyx:754:35: Cannot assign type 'int (void *, int, int, int, ParOptVec *, ParOptScalar *, ParOptVec *, ParOptVec *) except? -1' to 'evalhessiandiag'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setGetVarsAndBounds(_getvarsandbounds)
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
                                                      ^
------------------------------------------------------------

paropt/ParOpt.pyx:755:54: Cannot assign type 'void (void *, int, int, ParOptVec *, ParOptScalar *, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'computequasinewtonupdatecorrection'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalObjCon(_evalobjcon)
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
                                 ^
------------------------------------------------------------

paropt/ParOpt.pyx:756:33: Cannot assign type 'void (void *, int, int, ParOptVec *, ParOptVec *) except *' to 'evalsparsecon'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalObjConGradient(_evalobjcongradient)
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
        self.me.setAddSparseJacobian(_addsparsejacobian)
                                     ^
------------------------------------------------------------

paropt/ParOpt.pyx:757:37: Cannot assign type 'void (void *, int, int, ParOptScalar, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'addsparsejacobian'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalHvecProduct(_evalhvecproduct)
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
        self.me.setAddSparseJacobian(_addsparsejacobian)
        self.me.setAddSparseJacobianTranspose(_addsparsejacobiantranspose)
                                              ^
------------------------------------------------------------

paropt/ParOpt.pyx:758:46: Cannot assign type 'void (void *, int, int, ParOptScalar, ParOptVec *, ParOptVec *, ParOptVec *) except *' to 'addsparsejacobiantranspose'

Error compiling Cython file:
------------------------------------------------------------
...
        self.me.setEvalHessianDiag(_evalhessiandiag)
        self.me.setComputeQuasiNewtonUpdateCorrection(_computequasinewtonupdatecorrection)
        self.me.setEvalSparseCon(_evalsparsecon)
        self.me.setAddSparseJacobian(_addsparsejacobian)
        self.me.setAddSparseJacobianTranspose(_addsparsejacobiantranspose)
        self.me.setAddSparseInnerProduct(_addsparseinnerproduct)
                                         ^
------------------------------------------------------------

paropt/ParOpt.pyx:759:41: Cannot assign type 'void (void *, int, int, int, ParOptScalar, ParOptVec *, ParOptVec *, ParOptScalar *) except *' to 'addsparseinnerproduct'
Traceback (most recent call last):
  File "/optimizer/py/paropt/setup.py", line 122, in <module>
    ext_modules=cythonize(exts, language="c++", include_path=inc_dirs),
  File "/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
    cythonize_one(*args)
  File "/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: paropt/ParOpt.pyx

Any idea, how I can resolve this?

Thanks!

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

No branches or pull requests

1 participant