Closed Kohki0401 closed 4 months ago
Hi, this seems a problem with the moderngl library failing to create the OpenGL context.
Can you share some more information on the environment / distribution you are using to run this? Based on your setting you might need to take some steps to make sure OpenGL is working properly on the machine you are running.
I'm terribly sorry to reply late. and Thank you for your great support!! my env is below
I tried "xeyes" and "glxgears" and these worked on terminal
glxinfo | grep "OpenGL version" OpenGL version string: 4.6 (Compatibility Profile) Mesa 23.0.4-0ubuntu1~22.04.1
Thank you so much.
Hi, everything in your environment looks normal, and I can't seem to reproduce the problem on my ubuntu system.
I think the problem should be within the moderngl package and not the viewer.
As an additional test you could try cloning their repository and run some of their examples. For example, if you are interested in using the viewer in headless mode, you could try running from the conda environment the script moderngl/examples/headless/moderngl_logo.py
and see if you have the same issue there.
If the problem persists I would suggest opening an issue on that project.
An other thing that has worked for us in the past is to setup a new conda environment with a different python version, but I'm not sure if it would help in this case.
I tried moderngl/examples/headless/moderngl_logo.py on my env. It worked by changing python3 version from py3.8 to py3.9. but there are still same error...
of course I try to confirm moderngl package, but I have no idea to fix it...
Should I set path about OpenGL by using export ?
Do you mean that the moderngl example works in python 3.9 but not in python 3.8? If so, does the viewer then work with python 3.9 too?
I don't think there should be a need to set any environment variable with export.
I could solve this problem by changing moderngl_window/context/headless/window.py I edited "edit 'create_standalone_context' below self._ctx = moderngl.create_standalone_context(require=self.gl_version_code, backend="egl")
But I got the other error. I close this issue. Let me ask the other place.
When I use aitviewer below error happened. it seems to be from openGL context: I already saw previous issue and tried to fix it.
--------------------------------------------------------------log --------------------------------------------------------------- Traceback (most recent call last): File "scripts/visualize-SMPL.py", line 101, in
viewer = HeadlessRenderer()
File "/home/datasynthesizer/miniconda3/envs/simple_romp/lib/python3.8/site-packages/aitviewer/headless.py", line 38, in init
super().init(kwargs)
File "/home/datasynthesizer/miniconda3/envs/simple_romp/lib/python3.8/site-packages/aitviewer/viewer.py", line 72, in init
self.window = base_window_cls(
File "/home/datasynthesizer/miniconda3/envs/simple_romp/lib/python3.8/site-packages/moderngl_window/context/headless/window.py", line 23, in init
self.init_mgl_context()
File "/home/datasynthesizer/miniconda3/envs/simple_romp/lib/python3.8/site-packages/moderngl_window/context/headless/window.py", line 33, in init_mgl_context
self._ctx = moderngl.create_standalone_context(require=self.gl_version_code)
File "/home/datasynthesizer/miniconda3/envs/simple_romp/lib/python3.8/site-packages/moderngl/context.py", line 1667, in create_standalone_context
ctx.mglo, ctx.version_code = mgl.create_context(glversion=require, mode=mode, settings)
File "/home/datasynthesizer/miniconda3/envs/simple_romp/lib/python3.8/site-packages/glcontext/init.py", line 90, in create
return x11.create_context(**kwargs)
Exception: (standalone) cannot create context