openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.49k stars 8.59k forks source link

[Bug Report] Not comaptible with new `render_modes` in mujoco environement #3113

Open T-K-233 opened 1 year ago

T-K-233 commented 1 year ago

Describe the bug I'm using Mujoco 2.2.0. It seems that the new version now it supoprts new rendering modes (['human', 'rgb_array', 'depth_array', 'single_rgb_array', 'single_depth_array']), so it will generate an assertion error on supported render mode mismatch when making new environment.

Code example

env = gym.make("Humanoid-v4", render_mode="human")

results in

Traceback (most recent call last):
  File "/home/tk/Desktop/Biped-Mujoco-main/script/run_reference_motion.py", line 23, in <module>
    env = gym.make("Humanoid-v4", render_mode="human")
  File "/home/tk/.local/lib/python3.10/site-packages/gym/envs/registration.py", line 640, in make
    env = env_creator(**_kwargs)
  File "/home/tk/Desktop/Biped-Mujoco-main/./biped/biped.py", line 234, in __init__
    MujocoEnv.__init__(
  File "/home/tk/.local/lib/python3.10/site-packages/gym/envs/mujoco/mujoco_env.py", line 311, in __init__
    super().__init__(
  File "/home/tk/.local/lib/python3.10/site-packages/gym/envs/mujoco/mujoco_env.py", line 61, in __init__
    assert self.metadata["render_modes"] == [
AssertionError: ['human', 'rgb_array', 'depth_array', 'single_rgb_array', 'single_depth_array']

System Info Describe the characteristic of your environment:

Additional context Null

Checklist

pseudo-rnd-thoughts commented 1 year ago

What gym version are you using? gym.version.VERSION

I can't replicate this with gym v26.1

T-K-233 commented 1 year ago

Hi,

I'm installing gym and mujoco by running pip install gym[mujoco] without version specifications. The version I see is 0.26.1.

I just tried with a new Ubuntu install, now the pip install will get me 0.26.2, but the error still persists.

tk@TK-Avenue-Ubuntu:~/Desktop$ pip install gym[mujoco]
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: gym[mujoco] in /home/tk/.local/lib/python3.10/site-packages (0.26.2)
Requirement already satisfied: numpy>=1.18.0 in /home/tk/.local/lib/python3.10/site-packages (from gym[mujoco]) (1.23.3)
Requirement already satisfied: gym-notices>=0.0.4 in /home/tk/.local/lib/python3.10/site-packages (from gym[mujoco]) (0.0.8)
Requirement already satisfied: cloudpickle>=1.2.0 in /home/tk/.local/lib/python3.10/site-packages (from gym[mujoco]) (2.2.0)
Requirement already satisfied: imageio>=2.14.1 in /home/tk/.local/lib/python3.10/site-packages (from gym[mujoco]) (2.22.1)
Requirement already satisfied: mujoco==2.2 in /home/tk/.local/lib/python3.10/site-packages (from gym[mujoco]) (2.2.0)
Requirement already satisfied: glfw in /home/tk/.local/lib/python3.10/site-packages (from mujoco==2.2->gym[mujoco]) (2.5.5)
Requirement already satisfied: absl-py in /home/tk/.local/lib/python3.10/site-packages (from mujoco==2.2->gym[mujoco]) (1.2.0)
Requirement already satisfied: pyopengl in /home/tk/.local/lib/python3.10/site-packages (from mujoco==2.2->gym[mujoco]) (3.1.6)
Requirement already satisfied: pillow>=8.3.2 in /usr/lib/python3/dist-packages (from imageio>=2.14.1->gym[mujoco]) (9.0.1)