cyglfw3
cyglfw3 copied to clipboard
Cython.CompileError (None, pyx_file) when pip install cyglfw3
cyglfw3/glfw3.pyx:730:76: Cannot assign type 'void (GLFWwindow *, int, int, int) except *' to 'GLFWmousebuttonfun'
Error compiling Cython file:
------------------------------------------------------------
...
cglfw3.glfwSetMouseButtonCallback(<cglfw3.GLFWwindow*>window._this_ptr, mousebuttonfun_cb)
def SetCursorEnterCallback(Window window, cbfun):
global _cursorenterfuns
_cursorenterfuns[<size_t>window._this_ptr] = cbfun
cglfw3.glfwSetCursorEnterCallback(<cglfw3.GLFWwindow*>window._this_ptr, cursorenterfun_cb)
^
------------------------------------------------------------
cyglfw3/glfw3.pyx:735:76: Cannot assign type 'void (GLFWwindow *, int) except *' to 'GLFWcursorenterfun'
Error compiling Cython file:
------------------------------------------------------------
...
cglfw3.glfwSetCursorEnterCallback(<cglfw3.GLFWwindow*>window._this_ptr, cursorenterfun_cb)
def SetScrollCallback(Window window, cbfun):
global _scrollfuns
_scrollfuns[<size_t>window._this_ptr] = cbfun
cglfw3.glfwSetScrollCallback(<cglfw3.GLFWwindow*>window._this_ptr, scrollfun_cb)
^
------------------------------------------------------------
cyglfw3/glfw3.pyx:740:71: Cannot assign type 'void (GLFWwindow *, double, double) except *' to 'GLFWscrollfun'
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-7aaqwjk4/cyglfw3_6e6ac56df95a4287a5e3b5d13d42ac4a/setup.py", line 43, in <module>
ext_modules = cythonize(ext_modules)
File "/data/chenminghaoData/anaconda3/envs/gdrnetpy38/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
cythonize_one(*args)
File "/data/chenminghaoData/anaconda3/envs/gdrnetpy38/lib/python3.8/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: cyglfw3/glfw3.pyx
Compiling cyglfw3/glfw3.pyx because it changed.
[1/1] Cythonizing cyglfw3/glfw3.pyx
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
Could you tell me how to solve this problem? I have checked several websites, but there is no relevant solution.
I'm not sure what environment you're trying to build in. But there's obviously a mismatch in the function signature in cyglfw and your version of GLFW3. The code appears to still be in sync with GLFW 3.3.
https://www.glfw.org/docs/latest/group__input.html#ga6ab84420974d812bee700e45284a723c https://www.glfw.org/docs/latest/group__input.html#gad27f8ad0142c038a281466c0966817d8 https://www.glfw.org/docs/latest/group__input.html#ga571e45a030ae4061f746ed56cb76aede
Collecting cyglfw3==3.1.0.2 Downloading cyglfw3-3.1.0.2.tar.gz (159 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.3/159.3 kB 2.4 MB/s eta 0:00:00 error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. Preparing metadata (setup.py) ... error error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details.
How to solve this problem???
I also encountered the same problem, have you solved it?
The same problem. Have you solved it?
I have just happend to solve this problem.
- VERSION : use GLFW3.3.0 version. Just as the ahthor said, cyglfw3 3.1.0.2 appears to still be in sync with GLFW 3.3.
- BUILD: when building GLFW3 mannually, make sure you use command like
cmake -DBUILD_SHARED_LIB=ON ..to make it generate .so file. This is because cyglfw3 3.1.0.2 use-lglfwto indicate the library name. In CMakeList.txt with verision of GLFW3.3, if you generate dynamic library file, you can get libglfw.so, which is perfect with cyglfw3 3.1.0.2; but if you generate static library file, you will get libglfw3.a, which will cause errors when pip install cyglfw3.
BTW, I use cython==0.28.2 and setuptools==63.0.1 Hopefully, this could help