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

Unable to install pyopengl-accelerate on py 3.12.3: src/numpy_formathandler.pyx:22:42: 'Py_intptr_t' is not a type identifier #118

Open
sanjayankur31 opened this issue Jun 18, 2024 · 9 comments

Comments

@sanjayankur31
Copy link

I'm unable to install pyopengl-accelerate on py3.12.3:

$ python --version
Python 3.12.3

Attempting to install it using Pip gives:

pip install PyOpenGL-accelerate --no-cache-dir
Collecting PyOpenGL-accelerate
  Downloading PyOpenGL-accelerate-3.1.7.tar.gz (562 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 562.1/562.1 kB 76.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: PyOpenGL-accelerate
  Building wheel for PyOpenGL-accelerate (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for PyOpenGL-accelerate (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [147 lines of output]
      /tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/config/expand.py:133: SetuptoolsWarning: File '/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/readme.txt' cannot be found
        return '\n'.join(
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/OpenGL_accelerate
      copying OpenGL_accelerate/__init__.py -> build/lib.linux-x86_64-cpython-312/OpenGL_accelerate
      running build_ext
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/OpenGL_accelerate/wrapper.pxd
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/wrapper.pyx because it changed.
      [1/1] Cythonizing src/wrapper.pyx
      building 'OpenGL_accelerate.wrapper' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/src
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/wrapper.c -o build/temp.linux-x86_64-cpython-312/src/wrapper.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/wrapper.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/wrapper.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/OpenGL_accelerate/formathandler.pxd
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/formathandler.pyx because it changed.
      [1/1] Cythonizing src/formathandler.pyx
      building 'OpenGL_accelerate.formathandler' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/formathandler.c -o build/temp.linux-x86_64-cpython-312/src/formathandler.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/formathandler.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/formathandler.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/arraydatatype.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/arraydatatype.pyx because it changed.
      [1/1] Cythonizing src/arraydatatype.pyx
      building 'OpenGL_accelerate.arraydatatype' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/arraydatatype.c -o build/temp.linux-x86_64-cpython-312/src/arraydatatype.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/arraydatatype.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/arraydatatype.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/errorchecker.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/errorchecker.pyx because it changed.
      [1/1] Cythonizing src/errorchecker.pyx
      building 'OpenGL_accelerate.errorchecker' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/errorchecker.c -o build/temp.linux-x86_64-cpython-312/src/errorchecker.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/errorchecker.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/errorchecker.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/vbo.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/vbo.pyx because it changed.
      [1/1] Cythonizing src/vbo.pyx
      building 'OpenGL_accelerate.vbo' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/vbo.c -o build/temp.linux-x86_64-cpython-312/src/vbo.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/vbo.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/vbo.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/nones_formathandler.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/nones_formathandler.pyx because it changed.
      [1/1] Cythonizing src/nones_formathandler.pyx
      building 'OpenGL_accelerate.nones_formathandler' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/nones_formathandler.c -o build/temp.linux-x86_64-cpython-312/src/nones_formathandler.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/nones_formathandler.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/nones_formathandler.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/latebind.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/latebind.pyx because it changed.
      [1/1] Cythonizing src/latebind.pyx
      building 'OpenGL_accelerate.latebind' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/latebind.c -o build/temp.linux-x86_64-cpython-312/src/latebind.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/latebind.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/latebind.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/buffers_formathandler.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      Compiling src/buffers_formathandler.pyx because it changed.
      [1/1] Cythonizing src/buffers_formathandler.pyx
      building 'OpenGL_accelerate.buffers_formathandler' extension
      gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src -I/tmp/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d -I/home/asinha/.local/share/virtualenvs/neuroml-312-dev/include -I/usr/include/python3.12 -c src/buffers_formathandler.c -o build/temp.linux-x86_64-cpython-312/src/buffers_formathandler.o
      gcc -shared build/temp.linux-x86_64-cpython-312/src/buffers_formathandler.o -L/usr/lib64 -o build/lib.linux-x86_64-cpython-312/OpenGL_accelerate/buffers_formathandler.cpython-312-x86_64-linux-gnu.so
      /tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/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/pip-install-716aw1bs/pyopengl-accelerate_06de659d8366410d902c7ac43ce98a6d/src/numpy_formathandler.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef int PyArray_CheckScalar( object )
          int NPY_ARRAY_CARRAY
          int NPY_ARRAY_FORCECAST
          int PyArray_ISCARRAY( np.ndarray instance )
          int PyArray_ISCARRAY_RO( np.ndarray instance )
          cdef np.ndarray PyArray_Zeros(int nd, np.Py_intptr_t* dims, np.dtype, int fortran)
                                                ^
      ------------------------------------------------------------

      src/numpy_formathandler.pyx:22:42: 'Py_intptr_t' is not a type identifier
      Compiling src/numpy_formathandler.pyx because it changed.
      [1/1] Cythonizing src/numpy_formathandler.pyx
      Traceback (most recent call last):
        File "/home/asinha/.local/share/virtualenvs/neuroml-312-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/asinha/.local/share/virtualenvs/neuroml-312-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/asinha/.local/share/virtualenvs/neuroml-312-dev/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 410, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 395, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 113, in <module>
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 968, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-938jgl79/normal/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 968, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 132, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 968, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 359, in run
          self.build_extensions()
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 479, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-938jgl79/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build_ext.py", line 505, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/site-packages/Cython/Distutils/build_ext.py", line 130, in build_extension
          new_ext = cythonize(
                    ^^^^^^^^^^
        File "/tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/tmp/pip-build-env-938jgl79/overlay/lib64/python3.12/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: src/numpy_formathandler.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for PyOpenGL-accelerate
Failed to build PyOpenGL-accelerate
ERROR: Could not build wheels for PyOpenGL-accelerate, which is required to install pyproject.toml-based projects

Weirdly enough, I do have wheels of pyopengl-accelerate for py3.12 in my pip cache, so it did build successfully at some point. Not sure what has changed. I only noticed this because it has started failing in our GitHub actions.

Any one else seeing this? Any ideas?

@totaam
Copy link

totaam commented Jun 18, 2024

FWIW: I don't need the numpy format handlers so I have used a brutal approach (ignore the fact that the patch is misnamed):
https://github.com/Xpra-org/xpra/blob/master/packaging/rpm/patches/pyopengl-py3.13-nonumpy.patch

@sanjayankur31
Copy link
Author

Thanks @totaam : not sure if this will work on our CI, I'll take a look.

sanjayankur31 added a commit to NeuroML/pyNeuroML that referenced this issue Jun 18, 2024
It does not currently build/install on py3.12:
mcfletch/pyopengl#118
@adonishong
Copy link

met same issue with python 3.9.16 and python 3.10.10 also under macOS Sonoma 14.5

@tomhaber
Copy link

Same issue here with python 3.12.4 :|

@WaleedFarooq51
Copy link

Has anybody found the solution of this problem? I am facing the same issue with Python version 3.12.3

@MoralCode
Copy link

MoralCode commented Sep 10, 2024

havent found the problem yet but i found a reference to Py_intptr_t in the numpy C ABI https://numpy.org/doc/stable/reference/c-api/dtype.html#c.npy_intp

Before NumPy 2.0, this was the same as Py_intptr_t. While a better match, this did not match actual usage in practice. On the Python side, we still support np.dtype('p') to fetch a dtype compatible with storing pointers, while n is the correct character for the ssize_t.

@MoralCode
Copy link

MoralCode commented Sep 10, 2024

this looks like it was fixed in 3.1.8, specifically commit f897b0e

https://github.com/mcfletch/pyopengl/releases/tag/release-3.1.8

seems like its just not released to pypi

Likely solutions until its released on pypi: install from git tag release-3.1.8 or install from the tarball in the release linked above

@captainjapeng
Copy link

For everyone looking to fix this using requirements.txt add the following code:

PyOpenGL @ git+https://github.com/mcfletch/pyopengl.git@release-3.1.8#egg=PyOpenGL
PyOpenGL_accelerate @ git+https://github.com/mcfletch/pyopengl.git@release-3.1.8#egg=PyOpenGL_accelerate&subdirectory=accelerate

@gulagkulak
Copy link

For everyone looking to fix this using requirements.txt add the following code:

PyOpenGL @ git+https://github.com/mcfletch/pyopengl.git@release-3.1.8#egg=PyOpenGL
PyOpenGL_accelerate @ git+https://github.com/mcfletch/pyopengl.git@release-3.1.8#egg=PyOpenGL_accelerate&subdirectory=accelerate

That didn't work for me. Just got a different error.

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

8 participants