p5 icon indicating copy to clipboard operation
p5 copied to clipboard

Error installing p5 package: Failed building wheel for PyOpenGL-accelerate

Open imhimansu28 opened this issue 2 years ago • 5 comments

Describe the bug

I encountered an error while trying to install the p5 package in Python. The installation process fails when building the wheel for the PyOpenGL-accelerate dependency. The error message and output are as follows:

To Reproduce

Run pip install p5 to install the p5 package.

Screenshots

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
╰─> [36 lines of output]
    Unable to import numpy, skipping numpy extension building
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.macosx-13-arm64-cpython-311
    creating build/lib.macosx-13-arm64-cpython-311/OpenGL_accelerate
    copying OpenGL_accelerate/__init__.py -> build/lib.macosx-13-arm64-cpython-311/OpenGL_accelerate
    running build_ext
    building 'OpenGL_accelerate.wrapper' extension
    ...
    src/wrapper.c:27136:21: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
                      CYTHON_FALLTHROUGH;
                      ^
    src/wrapper.c:27147:21: warning: fallthrough annotation in unreachable code [-Wunreachable-code-fallthrough]
                      CYTHON_FALLTHROUGH;
                      ^
    src/wrapper.c:28232:5: error: incomplete definition of type 'struct _frame'
      __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ...
    error: command '/usr/bin/clang' failed with exit code 1
    [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

System information:

Python version: 3.11 Operating System: macOS (version 13.4.1, Apple Silicon M1)

Additional context

I have numpy installed separately in my Python environment. I am using a virtual environment. I would appreciate any assistance in resolving this issue. Thank you!

imhimansu28 avatar Jul 14 '23 11:07 imhimansu28

Thank you for submitting your first issue to p5py

github-actions[bot] avatar Jul 14 '23 11:07 github-actions[bot]

3.11 is not supported yet. Can you try using 3.10

tushar5526 avatar Jul 15 '23 19:07 tushar5526

I am trying 3.10 version but still same error

imhimansu28 avatar Jul 18 '23 05:07 imhimansu28

@imhimansu28 Use version 3.8.

Consider using it with pyenv.

pyenv install 3.8
pyenv global 3.8
exec bash -l

If you're using ZSH try pyenv init first.

hvitis avatar Sep 30 '23 15:09 hvitis

I had the same kind of error recently, it seems to be a mac specific issue and the fix is to have numpy installed before installing PyOpenGL-accelerate. I believe there is a need to move to a better dependency management than requirements.txt.

tushar5526 avatar Nov 17 '23 09:11 tushar5526

Any news on this? Is it still Python 3.8 that is the latest supported version?

mannesson avatar Apr 15 '24 06:04 mannesson

The tests are running fine till 3.11 - https://github.com/p5py/p5/blob/master/.github/workflows/build-tests.yml#L16, Can you try again ?

tushar5526 avatar Apr 15 '24 15:04 tushar5526

I tried it today on my M3 mac with similar error as above.

mannesson avatar Apr 15 '24 18:04 mannesson

What is the python version ? Can you share the setup steps as well, did you create a virtual environment as well ?

tushar5526 avatar Apr 16 '24 04:04 tushar5526

Hi

I used a virtual environment, Python 3.11.2. Tried to install using pip3.

Anders

16 apr. 2024 kl. 06:41 skrev Tushar @.***>:

What is the python version ? Can you share the setup steps as well, did you create a virtual environment as well ?

— Reply to this email directly, view it on GitHub https://github.com/p5py/p5/issues/439#issuecomment-2058216166, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHVH4DNZGEZZ65OI5NDKXPDY5STX7AVCNFSM6AAAAAA2KHAPNSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYGIYTMMJWGY. You are receiving this because you commented.

mannesson avatar Apr 16 '24 18:04 mannesson

Hi,

  • Just went through the same obstacle to install the package on an Apple with M2, macOS 14.4.1 and Python 3.11.9 using pyenv and venv, it was not successful. The compilation of the PyOpenGL_accelerate package is the stumbling block.

mikefromd avatar May 06 '24 11:05 mikefromd

Ah, one more detail, I used the requirements.txt from the repo to control the installation with pip inside a fresh environment. Codeclub.org is now using the p5 package for their new Python courses, so it would be really good if the package could also run on an Apple Silicon machine. I am happy to give feedback to help in the process.

mikefromd avatar May 06 '24 11:05 mikefromd

Hey @mikefromd I will try to take a look on my Mac - but it might take some time as I am quite busy with other stuff. I tested this with m2 sometime back, but you can try commenting out the pyopengl_accelarate dependency.

tushar5526 avatar May 06 '24 13:05 tushar5526

Curious if any further guidance on this thread. I'm on an M1, Sonoma 14.5, Python 3.12.2, trying to get PyOpenGL as a dependency for running a USD pipeline. Same "ERROR: Failed building wheel for PyOpenGL_accelerate"

wrsmith108 avatar Jun 04 '24 16:06 wrsmith108

@wrsmith108 you can skip installing PyOpenGL_accelerate as I believe that library was added to help in better 3D rendering. For the failing build, did you tried checking out open issues in PyOpenGL_accelerate project?

tushar5526 avatar Jun 08 '24 10:06 tushar5526

TY @tushar5526 - I was building on my own machine and will redo a greenfield deployment for a USD pipeline for 3D rendering where this is a dependency. Ticket can be closed. Cheers.

wrsmith108 avatar Jun 09 '24 03:06 wrsmith108

I tried on M1 today. I tested 3.8, 3.9, 3.10 and 3.11 and all failed.

conda create -n p5 python=3.8 -y
conda activate p5
pip install numpy PyOpenGL
pip install PyOpenGL-accelerate

kylemcdonald avatar Jun 11 '24 17:06 kylemcdonald

I have the same problem using Mac M3 I opened an issue in pyopengl project, but the community seems to be kind of dead there.

Any alternatives on how to fix this without using opengl-accelerate?

ivanlen avatar Jun 12 '24 00:06 ivanlen

I managed to install p5 in an M3 without opengl-accelerate but I am not sure which are the limitations yet. How do to it.

  1. Download the requirements file
  2. Delete the line of opengl-accelerate
  3. Install reqs pip install -r requirements.txt
  4. Install p5 with no dependencies pip install p5 --no-dependencies

With this steps I can run some of the demo examples. If opengl-accelerate is a requirement I guess that at some point some things are going to break. Don't know what exactly.

ivanlen avatar Jun 12 '24 01:06 ivanlen

Hi! I just wanted to follow up here. Were there any updates to help install opengl-accelerate for Mac?

AkashShan1 avatar Jul 28 '24 01:07 AkashShan1