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

Rendering fails in multiple ways on Pong-v4 #450

Closed ikamensh closed 2 years ago

ikamensh commented 2 years ago
  1. Missing dependency pygame?
    pip install gym[atari]
    python -c "import gym; env=gym.make('Pong-v4'); env.render()"

    -> fails to import pygame


  1. no rendering in gym.envs.classic_control
    pip install gym[atari]
    pip install pygame
    python -c "import gym; env=gym.make('Pong-v4'); env.render()"

    ->

    File "/Users/kai7rng/opt/anaconda3/envs/matari/lib/python3.8/site-packages/gym/envs/atari/environment.py", line 264, in render
    from gym.envs.classic_control import rendering
    ImportError: cannot import name 'rendering' from 'gym.envs.classic_control' (/Users/kai7rng/opt/anaconda3/envs/matari/lib/python3.8/site-packages/gym/envs/classic_control/__init__.py)

Environment: MacOs with Python 3.8.5, gym dependencies:

ale-py==0.7.4
AutoROM==0.4.2
AutoROM.accept-rom-license==0.4.2
gym==0.23.1
gym-notices==0.0.6
pseudo-rnd-thoughts commented 2 years ago

Im able to replicate your issue with pip install gym[atari] but pip install pygame seems to fix it for me

JesseFarebro commented 2 years ago

Yes, env.render() is broken in the current release of Gym. I'll be releasing another update to fix this on our side.

It's worth noting that we do not recommend you use env.render(). Please supply the render_mode kwarg to the constructor, e.g.,

env = gym.make('ALE/Breakout-v5', render_mode='human')
JesseFarebro commented 2 years ago

With ale-py==0.7.5 we removed .render(mode="human"). This will now display a warning and instruct users to use the render_mode keyword argument when constructing the environment.