Search code examples
python-3.xreinforcement-learningopenai-gym

How to fix an error in open gym environment


I tried to install open gym Mario environment. Almost every tutorial tells me to do so.

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()
    observation, reward, done, info = env.step(env.action_space.sample())
    env.render()

env.close()

enter image description here


Solution

  • Try using gym version 0.24.1

    !pip install gym==0.24.1 gym_super_mario_bros==7.3.0 nes_py