While trying to run Hopper I ran into the following error:
File "/opt/conda/envs/saferl_env/lib/python3.8/site-packages/mo_gymnasium/envs/mujoco/hopper.py", line 23, in __init__
super().__init__(**kwargs)
File "/opt/conda/envs/saferl_env/lib/python3.8/site-packages/gymnasium/envs/mujoco/hopper_v4.py", line 206, in __init__
MujocoEnv.__init__(
File "/opt/conda/envs/saferl_env/lib/python3.8/site-packages/gymnasium/envs/mujoco/mujoco_env.py", line 333, in __init__
super().__init__(
File "/opt/conda/envs/saferl_env/lib/python3.8/site-packages/gymnasium/envs/mujoco/mujoco_env.py", line 52, in __init__
self._initialize_simulation() # may use width and height
File "/opt/conda/envs/saferl_env/lib/python3.8/site-packages/gymnasium/envs/mujoco/mujoco_env.py", line 351, in _initialize_simulation
self.model = mujoco.MjModel.from_xml_path(self.fullpath)
ValueError: XML Error: global coordinates no longer supported. To convert existing models, load and save them in MuJoCo 2.3.3 or older
Element 'compiler', line 2
After some digging, I discovered that MuJoCo 2.3.6 was installed in my environment. When I looked into pyproject.toml for mo-gymnasium I found that the requirements for MuJoCo were different depending on how the user chooses to install optional packages for mo-gymnasium
Specifically compare line 37 to line 50 in pyproject.toml. Line 37 (mo-gymnasium[mujoco]) allows any MuJoCo version later than 2.3.0, while Line 50 (mo-gymnasium[all]) strictly enforces MuJoCo==2.3.2
Steps to reproduce
Install optional MuJoCo dependencies for gymnasium and mo-gymnasium:
gymnasium will try to install mujoco 2.3.6, and pips dependency solver will not see a conflict as this satisfies mo-gymnasiums optional dependency variant for mujoco
Try to run a Hopper (or other) experiment
Solution
Change the MuJoCo version requirements for mo-gymnasium[mujoco] to match mo-gymnasium[all], i.e. change line 37 in pyproject.toml:
Background
While trying to run Hopper I ran into the following error:
After some digging, I discovered that MuJoCo 2.3.6 was installed in my environment. When I looked into
pyproject.toml
for mo-gymnasium I found that the requirements for MuJoCo were different depending on how the user chooses to install optional packages for mo-gymnasiumSpecifically compare line 37 to line 50 in
pyproject.toml
. Line 37 (mo-gymnasium[mujoco]) allows any MuJoCo version later than 2.3.0, while Line 50 (mo-gymnasium[all]) strictly enforces MuJoCo==2.3.2Steps to reproduce
Install optional MuJoCo dependencies for gymnasium and mo-gymnasium:
gymnasium will try to install mujoco 2.3.6, and pips dependency solver will not see a conflict as this satisfies mo-gymnasiums optional dependency variant for mujoco
Try to run a Hopper (or other) experiment
Solution
Change the MuJoCo version requirements for mo-gymnasium[mujoco] to match mo-gymnasium[all], i.e. change line 37 in pyproject.toml: