mcfletch / pyopengl

Repository for the PyOpenGL Project
Other
314 stars 97 forks source link

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 2 months ago

sanjayankur31 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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

adonishong commented 1 month ago

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

tomhaber commented 2 weeks ago

Same issue here with python 3.12.4 :|

WaleedFarooq51 commented 1 week ago

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