PLE requires the following libraries to be installed:

  • numpy
  • pillow
  • pygame

PyGame can be installed using this tutorial (Ubuntu). For mac you can use these following instructions;

brew install sdl sdl_ttf sdl_image sdl_mixer portmidi  # brew or use equivalent means
conda install -c https://conda.binstar.org/quasiben pygame  # using Anaconda

To install PLE first clone the repo:

git clone https://github.com/ntasfi/PyGame-Learning-Environment

Then use the cd command to enter the PyGame-Learning-Environment directory and run the command:

sudo pip install -e .

This will install PLE as an editable library with pip.


PLE allows agents to train against games through a standard model supplied by ple.PLE, which interacts and manipulates games on behalf of your agent. PLE mimics the Arcade Learning Environment (ALE) interface as closely as possible. This means projects using the ALE interface can easily be adjusted to use PLE with minimal effort.

If you do not wish to perform such modifications you can write your own code that interacts with PLE or use libraries with PLE support such as General Deep Q RL.

Here is an example of having an agent run against FlappyBird.

from ple.games.flappybird import FlappyBird
from ple import PLE

game = FlappyBird()
p = PLE(game, fps=30, display_screen=True)
agent = myAgentHere(allowed_actions=p.getActionSet())

reward = 0.0

for i in range(nb_frames):
   if p.game_over():

   observation = p.getScreenRGB()
   action = agent.pickAction(reward, observation)
   reward = p.act(action)