Closed fardinabbasi closed 5 months ago
Please refer to this discussion.
Please refer to this discussion.
Unfortunately, I still get the same error.
env = safety_gymnasium.make("SafetyRacecarCircle2Vision-v0")
env.reset()
env.step(env.action_space.sample())
FatalError Traceback (most recent call last)
[<ipython-input-28-e2c2c37d7088>](https://localhost:8080/#) in <cell line: 1>()
----> 1 env.reset()
2 env.step(env.action_space.sample())
10 frames
[/usr/local/lib/python3.10/dist-packages/gymnasium/wrappers/time_limit.py](https://localhost:8080/#) in reset(self, **kwargs)
73 """
74 self._elapsed_steps = 0
---> 75 return self.env.reset(**kwargs)
76
77 @property
[/usr/local/lib/python3.10/dist-packages/gymnasium/wrappers/order_enforcing.py](https://localhost:8080/#) in reset(self, **kwargs)
59 """Resets the environment with `kwargs`."""
60 self._has_reset = True
---> 61 return self.env.reset(**kwargs)
62
63 def render(self, *args, **kwargs):
[/usr/local/lib/python3.10/dist-packages/gymnasium/wrappers/env_checker.py](https://localhost:8080/#) in reset(self, **kwargs)
53 if self.checked_reset is False:
54 self.checked_reset = True
---> 55 return env_reset_passive_checker(self.env, **kwargs)
56 else:
57 return self.env.reset(**kwargs)
[/usr/local/lib/python3.10/dist-packages/gymnasium/utils/passive_env_checker.py](https://localhost:8080/#) in env_reset_passive_checker(env, **kwargs)
213
214 # Checks the result of env.reset with kwargs
--> 215 result = env.reset(**kwargs)
216
217 if not isinstance(result, tuple):
[/usr/local/lib/python3.10/dist-packages/safety_gymnasium/builder.py](https://localhost:8080/#) in reset(self, seed, options)
188
189 # Return an observation
--> 190 return (self.task.obs(), info)
191
192 def step(self, action: np.ndarray) -> tuple[np.ndarray, float, float, bool, bool, dict]:
[/usr/local/lib/python3.10/dist-packages/safety_gymnasium/bases/base_task.py](https://localhost:8080/#) in obs(self)
400
401 if self.observe_vision:
--> 402 obs['vision'] = self._obs_vision()
403
404 assert self.obs_info.obs_space_dict.contains(
[/usr/local/lib/python3.10/dist-packages/safety_gymnasium/bases/base_task.py](https://localhost:8080/#) in _obs_vision(self)
536 rows, cols = self.vision_env_conf.vision_size
537 width, height = cols, rows
--> 538 return self.render(width, height, mode='rgb_array', camera_name='vision', cost={})
539
540 def _ego_xy(self, pos: np.ndarray) -> np.ndarray:
[/usr/local/lib/python3.10/dist-packages/safety_gymnasium/bases/underlying.py](https://localhost:8080/#) in render(self, width, height, mode, camera_id, camera_name, cost)
513 )
514
--> 515 self._get_viewer(mode)
516
517 # Turn all the geom groups on
[/usr/local/lib/python3.10/dist-packages/safety_gymnasium/bases/underlying.py](https://localhost:8080/#) in _get_viewer(self, mode)
566 )
567 elif mode in {'rgb_array', 'depth_array'}:
--> 568 self.viewer = OffScreenViewer(self.model, self.data)
569 else:
570 raise AttributeError(f'Unexpected mode: {mode}')
[/usr/local/lib/python3.10/dist-packages/gymnasium/envs/mujoco/mujoco_rendering.py](https://localhost:8080/#) in __init__(self, model, data)
142 self._get_opengl_backend(width, height)
143
--> 144 super().__init__(model, data, width, height)
145
146 self._init_camera()
[/usr/local/lib/python3.10/dist-packages/gymnasium/envs/mujoco/mujoco_rendering.py](https://localhost:8080/#) in __init__(self, model, data, width, height)
59
60 # Keep in Mujoco Context
---> 61 self.con = mujoco.MjrContext(self.model, mujoco.mjtFontScale.mjFONTSCALE_150)
62
63 self._set_mujoco_buffer()
FatalError: gladLoadGL error
Please see this issue.
Please see this issue.
Sorry, but I tried all these solutions in colab and the same error still remains.
!echo 'export MUJOCO_GL=egl' >> ~/.bashrc
# Source .bashrc to apply changes
!source ~/.bashrc
or
bashrc_path = os.path.expanduser('~/.bashrc')
# Write the export command to .bashrc
with open(bashrc_path, 'a') as bashrc_file:
bashrc_file.write("export MUJOCO_GL=egl\n")
# Reload the environment to apply changes
os.system("source ~/.bashrc")
or
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
Could you please provide specific environment details and the latest reproducible source code? It would be helpful to include information about your system, hardware configuration, and a list of conda dependencies.
In this Colab notebook, you'll find code for rendering that can be executed successfully. You can also cross-reference your local environment with the environment in the Cloud Colab to troubleshoot any issues.
Required prerequisites
What version of Safety-Gymnasium are you using?
1.0.0
System information
sys.version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
sys.platfrom: linux
I am runing on colabProblem description
I am trying to render
SafetyRacecarButton2-v0
environment but I face some errors.Reproducible example code
Traceback