baba-is-auto icon indicating copy to clipboard operation
baba-is-auto copied to clipboard

Python error AssertionError: Observation space ... does not inherit from gym.spaces.Space

Open nickponline opened this issue 3 years ago • 3 comments

(dev) [nickp@m1 baba-babaisyou-v0 (main)]$ python3 DQN.py 
Traceback (most recent call last):
  File "DQN.py", line 16, in <module>
    env = gym.make('baba-babaisyou-v0')
  File "/Users/nickp/opt/anaconda3/envs/dev/lib/python3.7/site-packages/gym/envs/registration.py", line 601, in make
    env = PassiveEnvChecker(env)
  File "/Users/nickp/opt/anaconda3/envs/dev/lib/python3.7/site-packages/gym/wrappers/env_checker.py", line 25, in __init__
    check_observation_space(env.action_space)
  File "/Users/nickp/opt/anaconda3/envs/dev/lib/python3.7/site-packages/gym/utils/passive_env_checker.py", line 145, in check_observation_space
    f"Observation space ({observation_space}) does not inherit from gym.spaces.Space"
AssertionError: Observation space ([<Direction.UP: 1>, <Direction.DOWN: 2>, <Direction.LEFT: 3>, <Direction.RIGHT: 4>]) does not inherit from gym.spaces.Space
Python 3.7.10
gym.__version__ = '0.24.1'

nickponline avatar Jun 23 '22 22:06 nickponline

Thanks for report! I'll check it tonight. 😉

utilForever avatar Jul 07 '22 00:07 utilForever

Hi, I ran into the same issue and I believe it is due to gym being updated to a later version which is more strict regarding the creation of custom environments. Running the code on gym version 0.21.0 works for me.

Orr-Bezalely avatar Dec 15 '22 18:12 Orr-Bezalely

does anyone know how to update the code to match the lateest version?

BrianPark314 avatar Apr 11 '23 03:04 BrianPark314