dmlc / dgl

Python package built to ease deep learning on graph, on top of existing DL frameworks.
http://dgl.ai
Apache License 2.0
13.51k stars 3.02k forks source link

DGL install failed with Cython 3.0.0 #6039

Closed songqing closed 1 year ago

songqing commented 1 year ago

🐛 Bug

When installing DGL, I encountered a problem, it failed. It seems that the Cython has a break change in version 3.0.0, see issue, When I changed Cython to 0.29.21, the problem disappears.

To Reproduce

Steps to reproduce the behavior:

  1. pip3 install Cython==3.0.0
  2. run python3 setup.py install in the python directory

Expected behavior

` [1/1] Cythonizing dgl/_ffi/_cython/core.pyx

Error compiling Cython file: ... """ cdef DLManagedTensor* dltensor if self.c_is_view != 0: raise ValueError("to_dlpack do not work with memory views") CALL(DGLArrayToDLPack(self.chandle, &dltensor, alignment)) return pycapsule.PyCapsule_New(dltensor, _c_str_dltensor, _c_dlpack_deleter) ^

dgl/_ffi/_cython/./ndarray.pxi:80:66: Cannot assign type 'void (object) except ' to 'PyCapsule_Destructor' Traceback (most recent call last): File "setup.py", line 240, in ext_modules=config_cython(), File "setup.py", line 141, in config_cython return cythonize( File "/opt/conda/envs/pytorch-ci/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize cythonize_one(args) File "/opt/conda/envs/pytorch-ci/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: dgl/_ffi/_cython/core.pyx `

Environment

Xuweijia-buaa commented 1 year ago

same error

To Reproduce

1 bash script/create_dev_conda_env.sh -g 11.7 2 conda activate *** 3 bash script/build_dgl.sh -g -e '-DCMAKE_BUILD_TYPE=DEBUG' 4 python setup.py build_ext --inplace

Error Report

[1/1] Cythonizing dgl/_ffi/_cython/core.pyx

Error compiling Cython file: ... """ cdef DLManagedTensor* dltensor if self.c_is_view != 0: raise ValueError("to_dlpack do not work with memory views") CALL(DGLArrayToDLPack(self.chandle, &dltensor, alignment)) return pycapsule.PyCapsule_New(dltensor, _c_str_dltensor, _c_dlpack_deleter) ^

dgl/_ffi/_cython/./ndarray.pxi:80:66: Cannot assign type 'void (object) except *' to 'PyCapsule_Destructor' Traceback (most recent call last): File "setup.py", line 240, in ext_modules=config_cython(), File "setup.py", line 141, in config_cython return cythonize( File "/home/*/.conda/envs/dgl/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize cythonize_one(args) File "/home//.conda/envs/dgl/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: dgl/_ffi/_cython/core.pyx

Environment

OS (e.g., Linux): Ubuntu 20.04 DGL Version : master Backend Library & Version:PyTorch 1.13.0+gpu; Cython 3.0.0 How you installed DGL: source Build command you used: bash script/build_dgl.sh -g -e '-DCMAKE_BUILD_TYPE=DEBUG' Python version: 3.8.17

frozenbugs commented 1 year ago

Should be fixed by https://github.com/dmlc/dgl/pull/6052.