0

I'm trying to work for a RL project where I need to test the ideas in some Atari environement and I choose Pong to test the initial ideas. I'm using stable-baselines3 version 1.6.2 for ease of convenience. My gym version is 0.21.0. But I'm getting the following error while env.render is called

Exception has occurred: TypeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
render() takes 1 positional argument but 2 were given
  File "/home/s222147455/.conda/envs/new_method/lib/python3.8/site-packages/gym/core.py", line 295, in render
    return self.env.render(mode, **kwargs)
  File "/home/s222147455/.conda/envs/new_method/lib/python3.8/site-packages/gym/core.py", line 295, in render
    return self.env.render(mode, **kwargs)
  File "/home/s222147455/.conda/envs/new_method/lib/python3.8/site-packages/gym/core.py", line 295, in render
    return self.env.render(mode, **kwargs)
  [Previous line repeated 4 more times]

The gym library is wrapped as follows,

env = AtariWrapper(gym.make(args.env), noop_max=30, frame_skip=4, screen_size=84, terminal_on_life_loss=True, clip_reward=False)
    env = DummyVecEnv([lambda: env]) 
    env = VecFrameStack(env, n_stack=4, channels_order='first')

I have googled the issue and came to know that there is some mismatch in the gym version. But I couldn't fully resolve the issues

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
user19826638
  • 31
  • 1
  • 4

1 Answers1

0

VecFrameStack doesn't inherit the render_mode of the env it wraps around. No insight as to why that is but a quick hack/workaround should work:

...
env = DummyVecEnv([lambda: env]) 
env = VecFrameStack(env, n_stack=4, channels_order='first')
env.render_mode = "rgb_array"
...