Closed sudislife closed 2 years ago
Can you try running things outside of your Jupyter notebook? I believe this is just an issue with Jupyter, we use SDL for rendering and just because of the architecture of the Jupyter kernel I don't believe we get the proper window polling events so things will freeze as you described.
It would be feasible to support Jupyter natively by having a custom component that renders to an HTML canvas but this currently isn't on my radar.
Okay, so with the help of the people here https://github.com/openai/gym/issues/2726 I made the code cell below which runs perfectly on jupyter notebook. It's random actions in the code cell but you can replace that with your agent. Thanks for the help.
import gym
import time
env = gym.make('ALE/Breakout-v5', render_mode = 'human')
obs = env.reset()
for steps in range(200):
time.sleep(0.1)
action = env.action_space.sample()
obs, rew, done, info = env.step(action)
env.close()
The previous comment still applies within a Notebook. If you stop calling step the render window won't respond. Outside of a notebook this isn't the case as it can respond to the event loop properly.
gym.make('ALE/Breakout-v5', render_mode = 'human')
does not work for me, it gives me an Arcade Learning Environment Window which is stuck on not responding and if I try to close it, the kernel dies. (I've waited for the ALE to load for more than 10 mins and it still stays stuck on not responding).I'm getting this by simply running this cell in the jupyter notebook without running any other cells before it...
Running the same code on a script leads to the ALE opening and closing within a split second with the same blank white screen. Funny thing is there's this thing which happens when I run this cell after the one above
What I want shows up, however, both windows are completely unresponsive and you have to close it via the task manager which also leads to the kernel dying.
My Pip List and installs
I've already
pip install gym[accept-rom-license]
,pip install gym[atari]
,pip install ale-py
, andpip install pygame