openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.87k stars 815 forks source link

mujoco_py.cymj.GlfwError: Failed to create GLFW window #591

Open ashBabu opened 3 years ago

ashBabu commented 3 years ago

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

MianchuWang commented 3 years ago

The same issue :(

a-z-e-r-i-l-a commented 3 years ago

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

MianchuWang commented 3 years ago

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

yyimingucl commented 3 years ago

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

MianchuWang commented 3 years ago

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

dogged1021 commented 3 years ago

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

longfeizhang617 commented 2 years ago

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

wkkdhj commented 3 months ago

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