3-manifolds/SnapPy

error: No module named 'snappy.CyOpenGL'

Closed this issue · 5 comments

karqo commented

Having installed Snappy on Ubuntu (16.04 with python 3.9) as outlined in documentation,
I get the following error on starting it (~/.local/bin/SnapPy):

Traceback (most recent call last):
  File "~/.local/bin/SnapPy", line 5, in <module>
    from snappy.app import main
  File "~/.local/lib/python3.9/site-packages/snappy/app.py", line 17, in <module>
    from .browser import Browser
  File "~/.local/lib/python3.9/site-packages/snappy/browser.py", line 6, in <module>
    from .polyviewer import PolyhedronViewer
  File "~/.local/lib/python3.9/site-packages/snappy/polyviewer.py", line 6, in <module>
    from .CyOpenGL import *
ModuleNotFoundError: No module named 'snappy.CyOpenGL'

It sounds like you are building SnapPy from source and you don't have an opengl development package installed on your system. Did you run
python3 -m pip install --upgrade --user pip wheel
as it says in the instructions? You might try upgrading setuptools as well.

karqo commented

Yes, I did run this and the other commands as it says in the instructions.
Setuptools is upgraded as well.
However, the error stays the same.
Isn't it that the missing CyOpenGL module is supposed to be a module of Snappy as the code in polyviewer.py suggests?

This is the error one gets when SnapPy was built from the source tarball but certain OpenGL header files are missing. Hence it was unable to build CyOpenGL. Two possible fixes:

First, you can try uninstalling and forcing it to use the binary wheel:

python3 -m pip uninstall snappy
python3 -m pip install --only-binary snappy --user snappy

Second, you can install the missing header files and rebuild:

sudo apt-get install libglu1-mesa-dev
python3 -m pip uninstall snappy
python3 -m pip install --no-binary snappy --user snappy

Let us know if either works for you.

karqo commented

Ok,
the first approach yields

ERROR: Could not find a version that satisfies the requirement snappy
ERROR: No matching distribution found for snappy

The second, however, works
(remark: libglu1-mesa-dev was installed already; so, crucial has been the command
python3 -m pip install --no-binary snappy --user snappy
).
Thank you very much.

From #35, the reason the first approach did not work for you is that you have a 32bit Linux system and we only post binary wheels for 64bit. Glad to hear the second approach did work, modulo #35.