question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EGL initialization error

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
geyangcommented, Jan 4, 2020

@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)

export MUJOCO_GL="osmesa"

Here is the full setup for a headless linux box with no built-in X display:

      export MUJOCO_GL=osmesa
      export MJLIB_PATH=$HOME/.mujoco/mujoco200/bin/libmujoco200.so
      export MJKEY_PATH=$HOME/.mujoco/mujoco200/mjkey.txt
      export LD_LIBRARY_PATH=$HOME/.mujoco/mujoco200/bin:$LD_LIBRARY_PATH
      export MUJOCO_PY_MJPRO_PATH=$HOME/.mujoco/mujoco200/
      export MUJOCO_PY_MJKEY_PATH=$HOME/.mujoco/mujoco200/mjkey.txt

@saran-t maybe we can add this to the documentation? 😃

5reactions
alimuldalcommented, Jan 7, 2020

I think this was due to an upstream change in PyOpenGL. In versions newer than 3.1.4, OpenGL.EGL has its own EGLDeviceEXT member (https://github.com/mcfletch/pyopengl/commit/38f4cc533b2ed3e85c585c4a4f00ed06f7aa6056), which overrides our assignment of EGLDeviceEXT = ctypes.c_void_p when we do the wildcard import on the last line. Consequently we end up with mismatching pointer types in _eglQueryDevicesEXT and in the body of eglQueryDevicesEXT. I’ll put together a fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

eglInitialize failed - EGL - Khronos Forums
Hi Community, I am trying to run a testing code for EGL, but it failed in initialization. Here is my testing code.
Read more >
238513 – [GTK] EGLDisplay Initialization failed on Ubuntu ...
When run from the command line this shows: EGLDisplay Initialization failed: EGL_NOT_INITIALIZED Cannot create EGL context: invalid display ...
Read more >
"Failed to create / initialize EGL display"? Can't open anything ...
When I attempt to open any collection / GUI file or anything that draws things, I'm getting the following error: Could not open...
Read more >
Avoid crash on EGL initialization failure with multi-GPU - GitLab
This series makes EGL initialization failure not fatal alone. A KMS device that fails EGL can still be used with the CPU copy...
Read more >
[RESOLVED] OpenGL fail after re-configuring Optimus driver
[32098:0218/002808.468945:ERROR:gl_surface_egl.cc(780)] EGL Driver message ... Exiting GPU process due to errors during initialization ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found