dm_control: EGL initialization error
Hi,
I’ve recently come across the following error, on a machine with Nvidia driver version: 440.33.01 CUDA version: 10.2, when trying to use EGL for headless rendering. The same exact code was running properly on a machine with CUDA Version 10.1 and driver version 390.
Any idea how to fix the issue? I’ve tried reinstalling dm_control with pip.
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/suite/__init__.py", line 28, in <module>
from dm_control.suite import acrobot
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/suite/acrobot.py", line 24, in <module>
from dm_control import mujoco
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/mujoco/__init__.py", line 18, in <module>
from dm_control.mujoco.engine import action_spec
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/mujoco/engine.py", line 44, in <module>
from dm_control import _render
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/_render/__init__.py", line 75, in <module>
Renderer = import_func()
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/_render/__init__.py", line 36, in _import_egl
from dm_control._render.pyopengl.egl_renderer import EGLContext
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/_render/pyopengl/egl_renderer.py", line 66, in <module>
EGL_DISPLAY = create_initialized_headless_egl_display()
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/_render/pyopengl/egl_renderer.py", line 49, in create_initialized_headless_egl_display
for device in EGL.eglQueryDevicesEXT():
File "/home/aj/miniconda3/envs/rlpyt/lib/python3.7/site-packages/dm_control/_render/pyopengl/egl_ext.py", line 65, in eglQueryDevicesEXT
success = _eglQueryDevicesEXT(max_devices, devices, num_devices)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: expected LP_c_void_p instance instead of EGLDeviceEXT_pointer_Array_10
Thanks, A
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (1 by maintainers)
@ajabri if X display is not available, you can use “osmesa” backend.
(for the interest of others: won’t work even if you install Xvfb and GLFW because they require X-display)
Here is the full setup for a headless linux box with no built-in X display:
@saran-t maybe we can add this to the documentation? 😃
I think this was due to an upstream change in PyOpenGL. In versions newer than 3.1.4,
OpenGL.EGLhas its ownEGLDeviceEXTmember (https://github.com/mcfletch/pyopengl/commit/38f4cc533b2ed3e85c585c4a4f00ed06f7aa6056), which overrides our assignment ofEGLDeviceEXT = ctypes.c_void_pwhen we do the wildcard import on the last line. Consequently we end up with mismatching pointer types in_eglQueryDevicesEXTand in the body ofeglQueryDevicesEXT. I’ll put together a fix.So I just spent hours on this, and I’m not an expert, so I might say something wrong. But, in my case, I was trying to run it over SSH, so I suspect that’s what caused the headless display to not work. So, I tried switching the backend, but
export MUJOCO_GL="glfw"or osmesa or whatever didn’t make it not choose egl, so I had to go to the__init.py__file fromdmcontrol/_renderand set theBACKENDvariable right at the beginning to'osmesa', which then made it finally use osmesa as the backend.This way exactly solve me from those terrible mistakes