mujoco-py icon indicating copy to clipboard operation
mujoco-py copied to clipboard

mujoco_py.cymj.GlfwError: Failed to create GLFW window

Open ashBabu opened this issue 5 years ago • 9 comments

Hi, I get the error

  File "/home/ashith/Ash/repo/spaceRobot_RL/MBRL/spacerobot/spacerobot_mbrl.py", line 402, in <module>
    mbrl.run_mbrl(train=train, iter=500)
  File "/home/ashith/Ash/repo/spaceRobot_RL/MBRL/spacerobot/spacerobot_mbrl.py", line 83, in run_mbrl
    iter=iter, retrain_after_iter=30, render=True)
  File "/home/ashith/Ash/repo/spaceRobot_RL/MBRL/spacerobot/mppi_polo.py", line 383, in run_mppi
    env.render()
  File "/home/ashith/Ash/venv_tf_gpu/lib/python3.6/site-packages/gym/envs/mujoco/mujoco_env.py", line 158, in render
    self._get_viewer(mode).render()
  File "/home/ashith/Ash/venv_tf_gpu/lib/python3.6/site-packages/gym/envs/mujoco/mujoco_env.py", line 170, in _get_viewer
    self.viewer = mujoco_py.MjViewer(self.sim)
  File "/home/ashith/Ash/venv_tf_gpu/lib/python3.6/site-packages/mujoco_py/mjviewer.py", line 137, in __init__
    super().__init__(sim)
  File "/home/ashith/Ash/venv_tf_gpu/lib/python3.6/site-packages/mujoco_py/mjviewer.py", line 28, in __init__
    super().__init__(sim)
  File "mujoco_py/mjrendercontext.pyx", line 311, in mujoco_py.cymj.MjRenderContextWindow.__init__
  File "mujoco_py/mjrendercontext.pyx", line 46, in mujoco_py.cymj.MjRenderContext.__init__
  File "mujoco_py/mjrendercontext.pyx", line 102, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
  File "mujoco_py/opengl_context.pyx", line 48, in mujoco_py.cymj.GlfwContext.__init__
  File "mujoco_py/opengl_context.pyx", line 99, in mujoco_py.cymj.GlfwContext._create_window
mujoco_py.cymj.GlfwError: Failed to create GLFW window
GLFW error (code %d): %s 65543 b'GLX: Failed to create context: BadValue (integer parameter out of range for operation)'

I am on Ubuntu 18.04. Followed all the steps as in the README.md. Interestingly it works in my laptop but when I do the exact same steps in lab system, i get the error. One thing I noticed is that my laptop has no Nvidia card whereas my lab system has. I have already added the following in my bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ashith/.mujoco/mujoco200/bin 
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so

Any help would be really appreciated

ashBabu avatar Nov 19 '20 19:11 ashBabu

The same issue :(

MianchuWang avatar Nov 30 '20 23:11 MianchuWang

@MianchuWang @ashBabu I have the same issue, have you found a workaround for it?

a-z-e-r-i-l-a avatar Jan 11 '21 21:01 a-z-e-r-i-l-a

@MianchuWang @ashBabu I have the same issue, have you found a workaround for it?

Hi, fortunately I solved the problem at last. The problem was raising when I was using a headless Linux server. The problem is that glfw is unavailable without a screen. However, we can use a virtual screen xvfb, like xvfb-run python foo.py. You can read http://elementalselenium.com/tips/38-headless for more details.

I don't know whether my situation is similar to yours, but I hope you can solve it soon. : )

MianchuWang avatar Jan 11 '21 21:01 MianchuWang

@MianchuWang @ashBabu I have the same issue, have you found a workaround for it?

Hi, fortunately I solved the problem at last. The problem was raising when I was using a headless Linux server. The problem is that glfw is unavailable without a screen. However, we can use a virtual screen xvfb, like xvfb-run python foo.py. You can read http://elementalselenium.com/tips/38-headless for more details.

I don't know whether my situation is similar to yours, but I hope you can solve it soon. : )

Hi Mianchu, Thanks a lot and your solution helps me. I wanna ask could we set up a GUI for a headless Linux server? I set up the environments in a docker container.

yyimingucl avatar Jul 06 '21 13:07 yyimingucl

@MianchuWang @ashBabu I have the same issue, have you found a workaround for it?

Hi, fortunately I solved the problem at last. The problem was raising when I was using a headless Linux server. The problem is that glfw is unavailable without a screen. However, we can use a virtual screen xvfb, like xvfb-run python foo.py. You can read http://elementalselenium.com/tips/38-headless for more details. I don't know whether my situation is similar to yours, but I hope you can solve it soon. : )

Hi Mianchu, Thanks a lot and your solution helps me. I wanna ask could we set up a GUI for a headless Linux server? I set up the environments in a docker container.

Hi. There are some ways to set up a GUI for a headless Linux server, e.g., TigerVNC. But I’m not very clear about the setup procedure. Sorry.

MianchuWang avatar Jul 07 '21 06:07 MianchuWang

I met the same issue and I rebooted the computer system, then the code worked without the problem. I have no idea what happend...

dogged1021 avatar Jul 25 '21 02:07 dogged1021

@MianchuWang @ashBabu I have the same issue, have you found a workaround for it?

Hi, fortunately I solved the problem at last. The problem was raising when I was using a headless Linux server. The problem is that glfw is unavailable without a screen. However, we can use a virtual screen xvfb, like xvfb-run python foo.py. You can read http://elementalselenium.com/tips/38-headless for more details. I don't know whether my situation is similar to yours, but I hope you can solve it soon. : )

Hi Mianchu, Thanks a lot and your solution helps me. I wanna ask could we set up a GUI for a headless Linux server? I set up the environments in a docker container.

I have fixed the same issue by your method , thank you very much.

longfeizhang617 avatar May 28 '22 17:05 longfeizhang617

Thank you very much, it's really helpful !!!

wkkdhj avatar Jul 21 '24 09:07 wkkdhj

I am still facing the same issue even with xvfb-run python foo.py - any one facing similar issue? thanks!

meghbhalerao avatar Nov 18 '24 21:11 meghbhalerao