Skip to main content

No project description provided

Project description

pre-commit Code style: black

A fork of gym-retro ('lets you turn classic video games into Gymnasium environments for reinforcement learning') with additional games, emulators and supported platforms. Since gym-retro is in maintenance now and doesn't accept new games, platforms or bug fixes, you can instead submit PRs with new games or features here in stable-retro.

Emulated Systems

System Linux Windows Apple
Atari 2600
NES
SNES
Nintendo 64 ✓† ✓†
Nintendo DS
Gameboy/Color ✓*
Gameboy Advance
Sega Genesis
Sega Master System
Sega CD
Sega 32X
Sega Saturn
Sega Dreamcast ✓‡
PC Engine
Arcade Machines

Installation

pip3 install stable-retro

or if the above doesn't work for your plateform:

pip3 install git+https://github.com/Farama-Foundation/stable-retro.git

If you plan to integrate new ROMs, states or emulator cores or plan to edit an existing env:

git clone https://github.com/Farama-Foundation/stable-retro.git
cd stable-retro
pip3 install -e .

Apple Silicon Installation (Tested on python3.10)

  • NOTE: The Game Boy (gambatte) emulator is not supported on Apple Silicon

Build from source

  1. pip install cmake wheel
  2. brew install pkg-config lua@5.3 libzip qt@5 capnp
  3. echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.zshrc
  4. export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
  5. pip install -e .

Build Integration UI

  1. build package from source
  2. cmake . -DCMAKE_PREFIX_PATH=/usr/local/opt/qt -DBUILD_UI=ON -UPYLIB_DIRECTORY
  3. make -j$(sysctl hw.ncpu | cut -d: -f2)
  4. open "Gym Retro Integration.app"

Docker image for M1 Macs: https://github.com/arvganesh/stable-retro-docker

Example

'Nature CNN' model trained using PPO on Airstriker-Genesis env (rom already included in the repo)

Tested on Ubuntu 20.04 and Windows 11 WSL2 (Ubuntu 20.04 VM)

sudo apt-get update
sudo apt-get install python3 python3-pip git zlib1g-dev libopenmpi-dev ffmpeg

You need to install a stable baselines 3 version that supports gymnasium

pip3 install git+https://github.com/Farama-Foundation/stable-retro.git
pip3 install stable_baselines3[extra]

Start training:

cd retro/examples
python3 ppo.py --game='Airstriker-Genesis-v0'

More advanced examples: https://github.com/MatPoliquin/stable-retro-scripts

Tutorials

Windows WSL2 + Ubuntu 22.04 setup guide: https://www.youtube.com/watch?v=vPnJiUR21Og

Game Integration tool: https://www.youtube.com/playlist?list=PLmwlWbdWpZVvWqzOxu0jVBy-CaRpYha0t

How to run a custom version of RetroArch that supports overriding player input with models trained with stable-retro/stable-baselines: https://www.youtube.com/watch?v=hkOcxJvJVjk

Discord channel

Join here: https://discord.gg/dXuBSg3B4D

Supported specs:

Plateforms:

  • Windows 10, 11 (via WSL2)
  • macOS 10.13 (High Sierra), 10.14 (Mojave)
  • Linux (manylinux1). Ubuntu 22.04 is recommended

CPU with SSE3 or better

Supported Pythons: 3.7 to 3.12

Documentation

Documentation is available at https://stable-retro.farama.org/ (work in progress)

See LICENSES.md for information on the licenses of the individual cores.

ROMs

Each game integration has files listing memory locations for in-game variables, reward functions based on those variables, episode end conditions, savestates at the beginning of levels and a file containing hashes of ROMs that work with these files.

Please note that ROMs are not included and you must obtain them yourself. Most ROM hashes are sourced from their respective No-Intro SHA-1 sums.

Run this script in the roms folder you want to import. If the checksum matches it will import them in the related game folder in stable-retro.

python3 -m retro.import .

The following non-commercial Sega Genesis ROM is included with Stable Retro for testing purposes:

List of other included ROMs.

BIOS

Some plateforms like Sega Saturn and Dreamcast also needs to be provided a BIOS. List of BIOS names and checksums.

Contributing

See CONTRIBUTING.md

There is an effort to get this project to the Farama Foundation Project Standards. These development efforts are being coordinated in the stable-retro channel of the Farama Foundation's Discord. Click here for the invite

Citation

@misc{stable-retro,
  author = {Poliquin, Mathieu},
  title = {Stable Retro, a maintained fork of OpenAI's gym-retro},
  year = {2025},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/Farama-Foundation/stable-retro}},
}

Papers

List of papers mentioning stable-retro. If you want your paper to be added here please open a github issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stable_retro-0.9.8.tar.gz (153.9 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

stable_retro-0.9.8-cp312-cp312-manylinux_2_28_x86_64.whl (122.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

stable_retro-0.9.8-cp312-cp312-macosx_11_0_arm64.whl (89.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

stable_retro-0.9.8-cp311-cp311-manylinux_2_28_x86_64.whl (122.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

stable_retro-0.9.8-cp311-cp311-macosx_11_0_arm64.whl (89.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

stable_retro-0.9.8-cp310-cp310-manylinux_2_28_x86_64.whl (122.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

stable_retro-0.9.8-cp310-cp310-macosx_11_0_arm64.whl (89.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

stable_retro-0.9.8-cp39-cp39-manylinux_2_28_x86_64.whl (122.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

stable_retro-0.9.8-cp39-cp39-macosx_11_0_arm64.whl (89.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

stable_retro-0.9.8-cp38-cp38-manylinux_2_28_x86_64.whl (122.6 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

stable_retro-0.9.8-cp38-cp38-macosx_11_0_arm64.whl (89.1 MB view details)

Uploaded CPython 3.8macOS 11.0+ ARM64

File details

Details for the file stable_retro-0.9.8.tar.gz.

File metadata

  • Download URL: stable_retro-0.9.8.tar.gz
  • Upload date:
  • Size: 153.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stable_retro-0.9.8.tar.gz
Algorithm Hash digest
SHA256 6a1c9e949bd17f97133c06c75d3555fd7793619f575a6df688a81f4ef05aa7f4
MD5 90041ee26f3ec2e0d90fbabdb801f5f1
BLAKE2b-256 2d35d733e877dcb5b1d3e75225034617377ed466aab71cd397b3d7514017de05

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b1e6ef1532368917bfbebd05d7f68a93dc98300273d9144d4b82ddc5790bdd8e
MD5 2412fb77eabcde1a5fd1634e7b7e4424
BLAKE2b-256 359d2c0264f0b5877a519a00eadfe7e14e4d33bfbd9ffccc582c9bb44893973c

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24ad2de4cda828d637c7ce9de8f088437b03f0da60d56c1d0d34a6747b937f6a
MD5 4a7b10dd380c062df2edfadfa4175f4d
BLAKE2b-256 0ad0501a255e10582af502b07fe5a98c592f5cd644c6db8f8b6faf5ecc8e5d67

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c201a226654a1ca1cb3485f4b03457507d9cf45acf8d8452735173ada5cd1e09
MD5 487e0d4b79cb7e929c2968a0d453ee10
BLAKE2b-256 05f209110d33f9a084a03f06e597a32c9917f492246bf667202a27b283ca78d5

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ba8db3abeb397544a36838e1d361aeac908ed5d4916443f28ed564ab2591b91
MD5 d0a06b2a458e903d403869f2ef885018
BLAKE2b-256 051acb43d67675b0b36d57bea0ad56f9fdb2cabe9b7e82f9b413bb9fc41c5d43

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 39f91844fac3b6ea8ed50587d323f424ac1c266fa5d363f730d70d15c4a10e8f
MD5 c5c1f4a614a50c815261d1bcd45f34fd
BLAKE2b-256 1e65104047eb6c492f0891455399fbff3996138723a27e256416a44241343ab4

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67b172c314b18c94a30000a87bc2a8e34562e69212518a27428ec9440c05c173
MD5 f48a819d08646819a322798df88b3674
BLAKE2b-256 6ae6d0df0e354039f8d935725e8885ed22d02decbc4667b8c0c05fc009d64863

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3a68f6797e90452cdecd5ea032b72ba497fa01721af0c906a690958e801a7822
MD5 f8628da9d005ce829457881be123c9a3
BLAKE2b-256 1442052d5f9abdfc8a52a11bc98fe9b6e9764cf76f6bfde5636c8a94d8dd87c1

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 00be25677ef1292d84187658efcfc8d1373310dddca44e812d921dde4fabee60
MD5 b35730d7a7f1d6a2de9f60ae3b21df3f
BLAKE2b-256 dbd7a562e3759dc2b9e102a712966059fa60713cacc24da72d8915bff499240f

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0cf712a74410c56e41dcb3e3567c7b25b17281432015dacb593cd6065042f091
MD5 d288afb6585276ec50c2fc1898aadb00
BLAKE2b-256 520cddac3f49c17e5155598b41615dfd08bc98d0f3c352e583ea5915cd0177ca

See more details on using hashes here.

File details

Details for the file stable_retro-0.9.8-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stable_retro-0.9.8-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b804ef1304d355e808449799ff6864035f345f70cd8a7732e5eb228e75cab04a
MD5 e716ec02f3632c0ee9c53806c0c9be87
BLAKE2b-256 e95e739704b0a60154f07e9544e4776a55c7edab8a8fc2b3ccf319ac739cd932

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page