eth-ait / aitviewer

A set of tools to visualize and interact with sequences of 3D data.
MIT License
497 stars 46 forks source link

Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context #28

Closed zc-alexfan closed 1 year ago

zc-alexfan commented 1 year ago

It is just a script to open the viewer without any object inside but it doesn't seem to open openGL context:

➜  aitviewer git:(main) ✗ python test.py
libGL error: MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
libGL error: failed to load driver: swrast
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    v = Viewer()
  File "/home/zfan/aitviewer/aitviewer/viewer.py", line 139, in __init__
    self.window = base_window_cls(
  File "/home/zfan/aitviewer/aitviewer/utils/pyqt5_window.py", line 107, in __init__
    self.init_mgl_context()
  File "/home/zfan/anaconda3/envs/instant/lib/python3.8/site-packages/moderngl_window/context/base/window.py", line 170, in init_mgl_context
    self._ctx = moderngl.create_context(require=self.gl_version_code)
  File "/home/zfan/anaconda3/envs/instant/lib/python3.8/site-packages/moderngl/context.py", line 2004, in create_context
    ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, **settings)
  File "/home/zfan/anaconda3/envs/instant/lib/python3.8/site-packages/glcontext/__init__.py", line 90, in create
    return x11.create_context(**kwargs)
Exception: (detect) glXGetCurrentContext: cannot detect OpenGL context
zc-alexfan commented 1 year ago

The package was installed within conda. Somehow a conda environment with Python 3.8.10 has this issue while Python 3.8.1 does not.

So the solution was to install Python 3.8.1 environment instead.