mmatl / pyrender

Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes.
http://pyrender.readthedocs.io/
MIT License
1.31k stars 225 forks source link

Using pyrender on CPU #283

Open mofibo opened 6 months ago

mofibo commented 6 months ago

Hello,

I'm running a cpu docker image on EC2 instance, I want to use pyrender on it, but it raises this error:

    import pyrender
  File "/usr/local/lib/python3.8/site-packages/pyrender/__init__.py", line 3, in <module>
    from .light import Light, PointLight, DirectionalLight, SpotLight
  File "/usr/local/lib/python3.8/site-packages/pyrender/light.py", line 10, in <module>
    from OpenGL.GL import *
  File "/usr/local/lib/python3.8/site-packages/OpenGL/GL/__init__.py", line 4, in <module>
    from OpenGL.GL.VERSION.GL_1_1 import *
  File "/usr/local/lib/python3.8/site-packages/OpenGL/GL/VERSION/GL_1_1.py", line 14, in <module>
    from OpenGL.raw.GL.VERSION.GL_1_1 import *
  File "/usr/local/lib/python3.8/site-packages/OpenGL/raw/GL/VERSION/GL_1_1.py", line 7, in <module>
    from OpenGL.raw.GL import _errors
  File "/usr/local/lib/python3.8/site-packages/OpenGL/raw/GL/_errors.py", line 4, in <module>
    _error_checker = _ErrorChecker( _p, _p.GL.glGetError )
  File "/usr/local/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/x86_64-linux-gnu/libOSMesa.so.8: undefined symbol: glGetError

Is there any way to fix it?

Thanks :)

traversaro commented 6 months ago

Can you try to set the PYOPENGL_PLATFORM=osmesa env variable (assuming that you have mesa installed in your system)? See https://pyrender.readthedocs.io/en/latest/examples/offscreen.html .