MPI-IS / mesh

MPI-IS Mesh Processing Library
Other
663 stars 152 forks source link

Import psbody.mesh failed #45

Open WMCh opened 4 years ago

WMCh commented 4 years ago

Hi, I tested the package successfully on MacOS 10.14 but failed on MacOS 11 recently released. Specifically, I had no problems during compiling or even import psbody. But when I import psbody.mesh, it returns something like this:

>>> import psbody
>>> import psbody.mesh
Traceback (most recent call last):
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 35, in GL
    return ctypesloader.loadLibrary(
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/ctypesloader.py", line 36, in loadLibrary
    return _loadLibraryWindows(dllType, name, mode)
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/ctypesloader.py", line 89, in _loadLibraryWindows
    return dllType( name, mode )
  File "/Users/***/opt/anaconda3/lib/python3.8/ctypes/__init__.py", line 373, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: ('dlopen(OpenGL, 10): image not found', 'OpenGL', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/psbody/mesh/__init__.py", line 10, in <module>
    from .meshviewer import MeshViewer, MeshViewers
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/psbody/mesh/meshviewer.py", line 49, in <module>
    from OpenGL import GL, GLU, GLUT
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/GL/__init__.py", line 3, in <module>
    from OpenGL import error as _error
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/error.py", line 12, in <module>
    from OpenGL import platform, _configflags
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/__init__.py", line 36, in <module>
    _load()
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/__init__.py", line 33, in _load
    plugin.install(globals())
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 97, in install
    namespace[ name ] = getattr(self,name,None)
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
    value = self.fget( obj )
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 62, in GetCurrentContext
    return self.CGL.CGLGetCurrentContext 
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
    value = self.fget( obj )
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 45, in CGL
    def CGL(self): return self.GL
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/baseplatform.py", line 15, in __get__
    value = self.fget( obj )
  File "/Users/***/opt/anaconda3/lib/python3.8/site-packages/OpenGL/platform/darwin.py", line 41, in GL
    raise ImportError("Unable to load OpenGL library", *err.args)
ImportError: ('Unable to load OpenGL library', 'dlopen(OpenGL, 10): image not found', 'OpenGL', None)

I have found some information about OpenGL in MacOS 11 like LINK. It sounds like OpenGL is still a part of MacOS 11 (though deprecated). However, I am not an expert on MacOS or OpenGL. Is there any advice for my situation? THANKS!

kaylolittlejohn commented 3 years ago

Same issue here.

kaylolittlejohn commented 3 years ago

Big Sur and above has depreciate pyopengl, however using os 11.1 (latest version as of 01/14/2021), this is a work around: https://stackoverflow.com/questions/65202395/pyopengl-on-macos-bigsur-and-opengl-error-nullfunctionerror.

WMCh commented 3 years ago

Thank you for @kaylolittlejohn's reply! I'll try it later.

kaylolittlejohn commented 3 years ago

np. I also had to use this workaround for Big Sur: https://github.com/mmatl/pyrender/issues/117. Once I did that and the above, it was able to output the rendered .mp4 file. Beforehand, mesh objects were created but not rendered to .mp4.

KelestZ commented 3 years ago

Thank you for @kaylolittlejohn's reply! I'll try it later.

np. I also had to use this workaround for Big Sur: mmatl/pyrender#117. Once I did that and the above, it was able to output the rendered .mp4 file. Beforehand, mesh objects were created but not rendered to .mp4.

Hi, I got the same issue. Seems I make all" successfully but when I usemake tests". It shew ImportError: ('Unable to load OpenGL library', 'dlopen(OpenGL, 10): image not found', 'OpenGL', None). Do you know how could I solve this? Thanks in advance!

kaylolittlejohn commented 3 years ago

Interesting, it's hard to say without knowing your OS, env details, etc.

KelestZ commented 3 years ago

Interesting, it's hard to say without knowing your OS, env details, etc. I'm using Big Sur 11.2.1, M1 chip, py3. Other env should be similar I guess.

kaylolittlejohn commented 3 years ago

I don't know exactly what's going on in your case but Mac has been slowly been phasing out OpenGL. It has officially deprecated and for my own programs I need to modify the source code in order to get it to work in many cases. Usually it's an absolute max of 20 lines of code to solve the problem. Check out the resource below; I think I may have actually encountered the same error before.

https://github.com/PixarAnimationStudios/USD/issues/1372