Kautenja / gym-super-mario-bros

An OpenAI Gym interface to Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The NES
Other
678 stars 133 forks source link

KeyError: 'render_modes' raised by gym_super_mario_bros.make('SuperMarioBros-v0') #116

Open andreaskopp opened 2 years ago

andreaskopp commented 2 years ago

Describe the bug

The sample code on https://pypi.org/project/gym-super-mario-bros/ raises KeyError: 'render_modes' with latest install

Reproduction Script

install: pip install gym-super-mario-bros

code: from nes_py.wrappers import JoypadSpace import gym_super_mario_bros from gym_super_mario_bros.actions import SIMPLE_MOVEMENT env = gym_super_mario_bros.make('SuperMarioBros-v0') env = JoypadSpace(env, SIMPLE_MOVEMENT)

done = True for step in range(5000): if done: state = env.reset() state, reward, done, info = env.step(env.action_space.sample()) env.render()

env.close()

Expected behavior

Code should execute without error

Screenshots


KeyError Traceback (most recent call last) Input In [1], in <cell line: 4>() 2 import gym_super_mario_bros 3 from gym_super_mario_bros.actions import SIMPLE_MOVEMENT ----> 4 env = gym_super_mario_bros.make('SuperMarioBros-v0') 5 env = JoypadSpace(env, SIMPLE_MOVEMENT) 7 done = True

File ~\Miniconda3\envs\rlgames\lib\site-packages\gym\envs\registration.py:625, in make(id, max_episode_steps, autoreset, new_step_api, disable_env_checker, **kwargs) 623 # If we have access to metadata we check that "render_mode" is valid 624 if hasattr(env_creator, "metadata"): --> 625 render_modes = env_creator.metadata["render_modes"] 627 # We might be able to fall back to the HumanRendering wrapper if 'human' rendering is not supported natively 628 if ( 629 mode == "human" 630 and "human" not in render_modes 631 and ("single_rgb_array" in render_modes or "rgb_array" in render_modes) 632 ):

KeyError: 'render_modes'

Additional context

Using Windows 11, Python 3.8 in Conda env

Add any other context about the problem here.

haidequanbu commented 2 years ago

Excuse me,have you found any solution for this hug?

SinclairGurny commented 2 years ago

I am facing this issue as well

madoe001 commented 1 year ago

Got the same problem. Did someone found a solution?

Prototype4988 commented 9 months ago

Hi guys. The issue is not with gym_super_mario_bros. It is with stable_baselines3. I used 0.11.0 version to resolve the issue