PaulDanielML / MuJoCo_RL_UR5

A MuJoCo/Gym environment for robot control using Reinforcement Learning. The task of agents in this environment is pixel-wise prediction of grasp success chances.
MIT License
413 stars 54 forks source link

RuntimeError: Failed to initialize OpenGL #23

Open sabinakaminska95 opened 9 months ago

sabinakaminska95 commented 9 months ago

Does anyone know how to solve this problem?

(mujoco_py) xxxx@XXXX:~/.mujoco/mujoco-py/examples/MuJoCo_RL_UR5$ python3 example_agent.py Creating window glfw Created new control group 'Arm'. Created new control group 'Gripper'. Model timestep: 0.002 Set number of frames skipped: 1 dt = timestep * frame_skip: 0.002 Frames per second = 1/dt: 500 Actionspace: MultiDiscrete([40000 6]) Observation space: Dict(rgb:Box(200, 200, 3), depth:Box(200, 200)) Found 1 GPUs for rendering. Using device 0. Could not make EGL context current Traceback (most recent call last): File "example_agent.py", line 16, in obs = env.reset() File "/home/xxxx/anaconda3/envs/mujoco_py/lib/python3.8/site-packages/gym/envs/mujoco/mujoco_env.py", line 108, in reset ob = self.reset_model() File "/home/xxxx/.mujoco/mujoco-py/examples/MuJoCo_RL_UR5/gym_grasper/envs/GraspingEnv.py", line 477, in reset_model return self.get_observation(show=self.show_observations) File "/home/xxxx/.mujoco/mujoco-py/examples/MuJoCo_RL_UR5/gym_grasper/envs/GraspingEnv.py", line 398, in get_observation rgb, depth = self.controller.get_image_data( File "/home/xxxx/.mujoco/mujoco-py/examples/MuJoCo_RL_UR5/gym_grasper/controller/MujocoController.py", line 719, in get_image_data self.sim.render(width=width, height=height, camera_name=camera, depth=True) 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 46, in mujoco_py.cymj.MjRenderContext.init File "mjrendercontext.pyx", line 114, 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

lllwin commented 5 months ago

I met the same problem. Have you solved this?

QWelkin commented 5 months ago

I met the same problem. Have you solved this?

STONEKONG commented 1 month ago

I solved. The following two lines of code conflict with each other and cannot be implemented at the same time, which is a bug of mujoco_py.

viewer = mujoco_py.MjViewer(sim) image = sim.render(width=300, height = 300, camera_name='cam0', depth=False)

YINJIAJU1123 commented 1 month ago

I solved. The following two lines of code conflict with each other and cannot be implemented at the same time, which is a bug of mujoco_py.

viewer = mujoco_py.MjViewer(sim) image = sim.render(width=300, height = 300, camera_name='cam0', depth=False)

@STONEKONG Hello, Stone! I agree that the error is caused by implementing these two lines of code together. But how should we solve it. Could you please share some suggestions? Thank you very much.