Farama-Foundation / Arcade-Learning-Environment

The Arcade Learning Environment (ALE) -- a platform for AI research.
GNU General Public License v2.0
2.12k stars 420 forks source link

ALE gets stuck on not responding #453

Closed sudislife closed 2 years ago

sudislife commented 2 years ago

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).

image image

I'm getting this by simply running this cell in the jupyter notebook without running any other cells before it...

import gym

env = gym.make('ALE/Breakout-v5', render_mode='human')

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

from gym.utils import play

play.play(env, zoom = 3)

image

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, and pip install pygame

ale-py 0.7.4
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
asttokens 2.0.5
attrs 21.4.0
AutoROM 0.4.2
AutoROM.accept-rom-license 0.4.2
backcall 0.2.0
beautifulsoup4 4.10.0
bleach 4.1.0
certifi 2021.10.8
cffi 1.15.0
charset-normalizer 2.0.12
click 8.1.2
cloudpickle 2.0.0
colorama 0.4.4
cycler 0.11.0
debugpy 1.6.0
decorator 5.1.1
defusedxml 0.7.1
entrypoints 0.4
executing 0.8.3
fonttools 4.31.2
gym 0.23.1
gym-notices 0.0.6
idna 3.3
importlib-metadata 4.11.3
importlib-resources 5.6.0
ipykernel 6.11.0
ipython 8.2.0
ipython-genutils 0.2.0
jedi 0.18.1
Jinja2 3.1.1
jsonschema 4.4.0
jupyter-client 7.2.1
jupyter-core 4.9.2
jupyterlab-pygments 0.1.2
kiwisolver 1.4.2
MarkupSafe 2.1.1
matplotlib 3.5.1
matplotlib-inline 0.1.3
mistune 0.8.4
nbclient 0.5.13
nbconvert 6.4.5
nbformat 5.2.0
nest-asyncio 1.5.4
notebook 6.4.10
numpy 1.22.3
packaging 21.3
pandocfilters 1.5.0
parso 0.8.3
pickleshare 0.7.5
Pillow 9.1.0
pip 21.2.4
prometheus-client 0.13.1
prompt-toolkit 3.0.28
psutil 5.9.0
pure-eval 0.2.2
pycparser 2.21
pygame 2.1.2
Pygments 2.11.2
pyparsing 3.0.7
pyrsistent 0.18.1
python-dateutil 2.8.2
pywin32 303
pywinpty 2.0.5
pyzmq 22.3.0
requests 2.27.1
Send2Trash 1.8.0
setuptools 61.3.1
six 1.16.0
soupsieve 2.3.1
stack-data 0.2.0
terminado 0.13.3
testpath 0.6.0
tornado 6.1
tqdm 4.63.1
traitlets 5.1.1
urllib3 1.26.9
wcwidth 0.2.5
webencodings 0.5.1
wheel 0.37.1
wincertstore 0.2
zipp 3.7.0
JesseFarebro commented 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.

sudislife commented 2 years ago

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()
JesseFarebro commented 2 years ago

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.