gymnasium
A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym).
What it is and what it does
Gymnasium is the maintained successor to OpenAI's Gym library, providing a standardized interface for reinforcement learning research and algorithm development. It defines how learning agents interact with environments through a simple API: agents observe state, take actions, and receive rewards. The library includes built-in environment families (Classic Control, Box2D, Toy Text, MuJoCo, Atari) and supports third-party environments that follow its API contract.
The package is built on numpy, cloudpickle, typing-extensions, and farama-notifications, keeping dependencies minimal for the base install. Environments are versioned strictly (e.g., CartPole-v1) to ensure reproducibility when algorithm results might be affected by environment changes. It is actively developed, production-stable, and widely used in the RL community for benchmarking and prototyping learning algorithms.
Use it for:
- Prototyping and testing new reinforcement learning algorithms against standard benchmarks like CartPole or MuJoCo control tasks
- Training agents on Atari 2600 games for research into deep RL methods
- Debugging RL implementations using simple discrete environments with small state/action spaces
- Building multi-agent systems via compatible third-party environments like PettingZoo
- Reproducing published RL research by leveraging strict environment versioning
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Gymnasium provides a standard Python API for building and testing reinforcement learning algorithms against a collection of environments ranging from simple toy problems to complex physics simulations and Atari games.
Yes. Gymnasium is the de facto standard RL environment interface in Python, actively maintained, production-stable, and has no known vulnerabilities. Install friction is low, dependencies are minimal, and the MIT license imposes no restrictions. Essential for anyone working in reinforcement learning research or algorithm development.
Install
gymnasium on PyPI
pip
pip install gymnasiumuv
uv add gymnasiumpoetry
poetry add gymnasiumInstalling gymnasium
Before you install
Low friction installation with a pure Python wheel. Actively maintained with recent releases; supports Python 3.10, 3.11, 3.12, and 3.13 on Linux and macOS. Base install includes core functionality; optional dependencies available for specific environment families.
License in practice
MIT License permits commercial and private use with minimal restrictions, making it suitable for both research and production projects.
Quickstart
pip install gymnasium
import gymnasium as gym
env = gym.make("CartPole-v1")
observation, info = env.reset(seed=42)
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
env.close()
Requires Python 3.10 or later. Optional environment families (Atari, MuJoCo, Box2D) require additional dependencies installable via pip extras.
Verify before relying
- Whether third-party environments maintain compatibility across Gymnasium versions without manual intervention
- Performance characteristics when running large-scale parallel environment instances
- Windows support status beyond the stated lack of official support
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — numpy, cloudpickle, typing-extensions, farama-notifications |
| Maintenance | actively maintained — 114 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,352,518/month — #1,632 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gymnasium-1.3.0-py3-none-any.whl
Keywords: Reinforcement Learning, game, RL, AI, gymnasium
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
ale-pyale-py provides a Python interface to the Atari…
copyleft · top 15,000 on PyPI
browsergym-coreBrowserGym provides a gymnasium environment for…
permissive · top 5,000 on PyPI
gym-alohaProvides a Gymnasium environment for the ALOHA…
permissive · top 15,000 on PyPI
pettingzooPettingZoo provides multi-agent reinforcement…
permissive · top 15,000 on PyPI
ShimmyShimmy converts external reinforcement learning…
permissive · top 15,000 on PyPI
openenv-coreOpenEnv provides a Gymnasium-style framework…
unclear · top 15,000 on PyPI
kaggle-environmentsKaggle Environments provides a framework for…
unclear · top 15,000 on PyPI
tianshouTianshou is a PyTorch-based reinforcement…
permissive · top 15,000 on PyPI
stable-baselines3Stable Baselines3 provides PyTorch…
permissive · top 5,000 on PyPI
reasoning-gymReasoning Gym generates procedurally verifiable…
permissive · top 15,000 on PyPI