Closed sudislife closed 2 years ago
Is the issue with gym.utils.play or Breakout because otherwise, I would post in https://github.com/mgbellemare/Arcade-Learning-Environment The issue could be related to juypter notebooks rather than gym itself though looking at the code, it seems to use 'rgb_array' rather than 'human' or in the constructor Could you specify what exactly the issue is
Next time, could you post the code instead of screenshots as it is difficult to see the code
No gym.utils.play works fine, simply running the following code gives me the blank Arcade Learning Environment Window.
import gym
env = gym.make('ALE/Breakout-v5', render_mode = 'human')
As you can see the output window is stuck on not responding...
However, I want something which looks like this in the Arcade Learning Environment Window... (FYI This is the output of...
import gym
from gym.utils import play
env = gym.make('ALE/Breakout-v5')
play.play(env, zoom = 3)
I need the gym environment to render this )
In hindsight, it does look like an issue for the https://github.com/mgbellemare/Arcade-Learning-Environment.
You need to call
env.reset()
and then do some step
s to actually render something.
Thank you so much. I tried running it with random actions and it works perfectly...
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()
I had the same problem. I used the following code and it worked perfectly.
import matplotlib.pyplot as plt
import gymnasium as gym
env = gym.make("BreakoutNoFrameskip-v4", render_mode="human")
env.reset()
env.render()
for i in range(10): env.step(1) # do nothing for 10 steps
# WARNING! THIS STEP MAY MAKE A LOUD NOISE, SO HEADPHONES OFF!
env.reset() # THIS STEP KILLS THE NOISE
My pip list I'm using python 3.9.11 and have the following installed on the environment 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
Code example I used jupyter notebook to run the two cells below
import gym
env = gym.make('ALE/Breakout-v5', render_mode='human')
I've tried both
env = gym.make('ALE/Breakout', render_mode='human')
andenv = gym.make('ALE/Breakout-v5', render_mode='human')
but the result was the same
Here's a screenshot
and was given the following window
System Info I'm using Windows 10 and I used pip install gym[accept-rom-license] after I was prompted by the following error to do so
Error: We're Unable to find the game "Breakout". Note: Gym no longer distributes ROMs. If you own a license to use the necessary ROMs for research purposes you can download them via pip install gym[accept-rom-license]. Otherwise, you should try importing "Breakout" via the command ale-import-roms. If you believe this is a mistake perhaps your copy of "Breakout" is unsupported. To check if this is the case try providing the environment variable PYTHONWARNINGS=default::ImportWarning:ale_py.roms. For more information see: https://github.com/mgbellemare/Arcade-Learning-Environment#rom-management