Attempt to retrieve context when no valid context
I used WSL + Ubuntu 24.04.
Exception in thread Thread-2 (_init_and_start_app): Traceback (most recent call last): File "/home/podys/anaconda3/envs/genesis/lib/python3.10/threading.py", line 1016, in _bootstrap_inner self.run() File "/home/podys/anaconda3/envs/genesis/lib/python3.10/threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 1149, in _init_and_start_app pyglet.clock.tick() File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/pyglet/clock.py", line 528, in tick return _default.tick(poll) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/pyglet/clock.py", line 270, in tick self.call_scheduled_functions(delta_t) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/pyglet/clock.py", line 217, in call_scheduled_functions item.func(now - item.last_ts, *item.args, **item.kwargs) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 941, in _time_event self.on_draw() File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 640, in on_draw self._render() File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/viewer.py", line 1086, in _render retval = renderer.render(self.scene, flags, seg_node_map=seg_node_map) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/renderer.py", line 141, in render self._update_context(scene, flags) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/renderer.py", line 899, in _update_context p._add_to_context() File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/genesis/ext/pyrender/primitive.py", line 359, in _add_to_context glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, FLOAT_SZ * 3, ctypes.c_void_p(0)) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/OpenGL/latebind.py", line 63, in call return self.wrapperFunction( self.baseFunction, *args, **named ) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/OpenGL/GL/VERSION/GL_2_0.py", line 469, in glVertexAttribPointer contextdata.setValue( key, array ) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/OpenGL/contextdata.py", line 58, in setValue context = getContext( context ) File "/home/podys/anaconda3/envs/genesis/lib/python3.10/site-packages/OpenGL/contextdata.py", line 40, in getContext raise error.Error( OpenGL.error.Error: Attempt to retrieve context when no valid context
I have the same problem like u, BUT USING WSL Ubuntu 20.04 https://github.com/Genesis-Embodied-AI/Genesis/issues/43#issuecomment-2554496334
By the way, may I inquirer how can u update the OpenGL version in order to solve the previous pyglet.gl.ContextException: Could not create GL context problem in my issue
Some possible solutions are in #37
I have the same problem like u, BUT USING WSL Ubuntu 20.04我有和你一样的问题,但是使用 WSL Ubuntu 20.04。 #43 (comment)
By the way, may I inquirer how can u update the OpenGL version in order to solve the previous
pyglet.gl.ContextException: Could not create GL contextproblem in my issue顺便问一下,我可以询问如何更新 OpenGL 版本以解决我问题中的pyglet.gl.ContextException: Could not create GL context问题吗?
https://github.com/Genesis-Embodied-AI/Genesis/issues/43#issuecomment-2553906781
for me (Ubuntu 20.04), the solution in #37 worked well:
import os
os.environ['PYOPENGL_PLATFORM'] = 'glx'
import genesis
It is noted that the MuJoCo GL should be set by export MUJOCO_GL=glx to avoid the MuJoCo error like ImportError: Cannot use EGL rendering platform. The PYOPENGL_PLATFORM environment variable is set to {!r} (should be either unset or 'egl').