Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to initialize OpenGL on evaluation #4

Open
erick-alv opened this issue Feb 14, 2021 · 3 comments
Open

Failed to initialize OpenGL on evaluation #4

erick-alv opened this issue Feb 14, 2021 · 3 comments

Comments

@erick-alv
Copy link

Hello, I am trying to setup the project in my own system. I am not using Docker since my mujoco key ist not valid for that. I have Ubuntu 18.04 and installed CUDA 10.0 and cudnn 7.6.5. However I am getting following error:

Doing evaluation of initial policy on 10 trials with randomly sampled tasks
====== finished initialization ======
Found 4 GPUs for rendering. Using device 1.
libEGL warning: DRI2: failed to create dri screen
libEGL warning: Not allowed to force software rendering when API explicitly selects a hardware device.
libEGL warning: DRI2: failed to create dri screen
Could not initialize EGL
Traceback (most recent call last):
File "/home/erick/RL/meld/meld/scripts/run_meld.py", line 1023, in
app.run(main)
File "/home/erick/anaconda3/envs/meld/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/erick/anaconda3/envs/meld/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "/home/erick/RL/meld/meld/scripts/run_meld.py", line 1020, in main
train_eval(FLAGS.root_dir, FLAGS.experiment_name, seed=FLAGS.seed)
File "/home/erick/anaconda3/envs/meld/lib/python3.6/site-packages/gin/config.py", line 1032, in wrapper
utils.augment_exception_message_and_reraise(e, err_str)
File "/home/erick/anaconda3/envs/meld/lib/python3.6/site-packages/gin/utils.py", line 49, in augment_exception_message_and_reraise
six.raise_from(proxy.with_traceback(exception.traceback), None)
File "", line 3, in raise_from
File "/home/erick/anaconda3/envs/meld/lib/python3.6/site-packages/gin/config.py", line 1009, in wrapper
return fn(*new_args, **new_kwargs)
File "/home/erick/RL/meld/meld/scripts/run_meld.py", line 809, in train_eval
log_image_observations=log_image_observations,
File "/home/erick/RL/meld/meld/utils/eval_summaries.py", line 93, in perform_eval_and_summaries_meld
time_step = env.reset()
File "/home/erick/RL/meld/agents/tf_agents/environments/py_environment.py", line 141, in reset
self._current_time_step = self._reset()
File "/home/erick/RL/meld/meld/environments/video_wrapper.py", line 22, in _reset
time_step = self._env.reset()
File "/home/erick/RL/meld/agents/tf_agents/environments/py_environment.py", line 141, in reset
self._current_time_step = self._reset()
File "/home/erick/RL/meld/agents/tf_agents/environments/wrappers.py", line 99, in _reset
return self._env.reset()
File "/home/erick/RL/meld/agents/tf_agents/environments/py_environment.py", line 141, in reset
self._current_time_step = self._reset()
File "/home/erick/RL/meld/agents/tf_agents/environments/gym_wrapper.py", line 177, in _reset
observation = self._gym_env.reset()
File "/home/erick/RL/meld/agents/tf_agents/environments/py_environment.py", line 141, in reset
self._current_time_step = self._reset()
File "/home/erick/RL/meld/meld/environments/gym_wrappers.py", line 153, in _reset
return self._modify_observation(observation)
File "/home/erick/RL/meld/meld/environments/gym_wrappers.py", line 124, in _modify_observation
image = self._env.sim.render(**self._render_kwargs)[::-1, :, :]
File "mjsim.pyx", line 156, in mujoco_py.cymj.MjSim.render
File "mjsim.pyx", line 158, in mujoco_py.cymj.MjSim.render
File "mjrendercontext.pyx", line 45, in mujoco_py.cymj.MjRenderContext.init
File "mjrendercontext.pyx", line 113, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
File "opengl_context.pyx", line 130, in mujoco_py.cymj.OffscreenOpenGLContext.init
RuntimeError: Failed to initialize OpenGL
In call to configurable 'train_eval' (<function train_eval at 0x7f81002c5a60>)

I read the issue openai/mujoco-py#187 to try some of the suggestion but none solves the error. As far as I understand, when calling self._env.sim.render(**self._render_kwargs) LD_PRELOAD should not have a value since some of the parameters are passed. I tried with an empty LD_PRELOAD and with LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/nvidia-xxx/libGL.so (for that I created the empty folder /usr/lib/nvidia-xxx since my system does not have one) but it does not work. Do you have any suggestion?

@newuhe
Copy link

newuhe commented Mar 30, 2021

I have the same problem. Have you solved it? @erick-alv

@mingyang-wang26
Copy link

Same problem here and also tried to change the LD_PRELOAD value but still can not fix it.

@NirViaje
Copy link

Seems like I solved this problem in #7 , the following is the guideline:

install the newest MuJoCo and mujoco-py, to enable headless rendering (in my case)

install the dedicated version of tensorflow 1.15 for CUDA11 (if you are on A100 or rtx3xxx in my case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants