# gymnasium

> A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym).

- **URL**: https://www.freshcrate.ai/projects/gymnasium
- **Author**: pypi
- **Category**: RAG & Memory
- **Latest version**: `v1.3.0` (2026-04-22)
- **License**: MIT License
- **Source**: https://github.com/Farama-Foundation/Gymnasium/issues
- **Homepage**: https://pypi.org/project/gymnasium/
- **Language**: Python
- **GitHub**: 11,766 stars, 1,318 forks
- **Registry**: pypi (`gymnasium`)
- **Tags**: `ai`, `game`, `gymnasium`, `learning`, `pypi`, `reinforcement`, `rl`

## Description

[![Python](https://img.shields.io/pypi/pyversions/gymnasium.svg)](https://badge.fury.io/py/gymnasium)
[![PyPI](https://badge.fury.io/py/gymnasium.svg)](https://badge.fury.io/py/gymnasium)
[![arXiv](https://img.shields.io/badge/arXiv-2407.17032-b31b1b.svg)](https://arxiv.org/abs/2407.17032)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/)
[![License](https://img.shields.io/github/license/Farama-Foundation/Gymnasium)](https://github.com/Farama-Foundation/Gymnasium/blob/main/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

<p align="center">
    <a href="https://gymnasium.farama.org/" target = "_blank">
    <img src="https://raw.githubusercontent.com/Farama-Foundation/Gymnasium/main/gymnasium-text.png" width="500px" />
</a>

</p>

Gymnasium is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API. This is a fork of OpenAI's [Gym](https://github.com/openai/gym) library by its maintainers (OpenAI handed over maintenance a few years ago to an outside team), and is where future maintenance will occur going forward.

The documentation website is at [gymnasium.farama.org](https://gymnasium.farama.org), and we have a public discord server (which we also use to coordinate development work) that you can join here: https://discord.gg/bnJ6kubTg6

## Environments

Gymnasium includes the following families of environments along with a wide variety of third-party environments
* [Classic Control](https://gymnasium.farama.org/environments/classic_control/) - These are classic reinforcement learning based on real-world problems and physics.
* [Box2D](https://gymnasium.farama.org/environments/box2d/) - These environments all involve toy games based around physics control, using box2d based physics and PyGame-based rendering
* [Toy Text](https://gymnasium.farama.org/environments/toy_text/) - These environments are designed to be extremely simple, with small discrete state and action spaces, and hence easy to learn. As a result, they are suitable for debugging implementations of reinforcement learning algorithms.
* [MuJoCo](https://gymnasium.farama.org/environments/mujoco/) - A physics engine based environments with multi-joint control which are more complex than the Box2D environments.
* [Atari](https://ale.farama.org/) - Emulator of Atari 2600 ROMs simulated that have a high range of complexity for agents to learn.
* [Third-party](https://gymnasium.farama.org/environments/third_party_environments/) - A number of environments have been created that are compatible with the Gymnasium API. Be aware of the version that the software was created for and use the `apply_env_compatibility` in `gymnasium.make` if necessary.

## Installation

To install the base Gymnasium library, use `pip install gymnasium`

This does not include dependencies for all families of environments (there's a massive number, and some can be problematic to install on certain systems). You can install these dependencies for one family like `pip install "gymnasium[atari]"` or use `pip install "gymnasium[all]"` to install all dependencies.

We support and test for Python 3.10, 3.11, 3.12 and 3.13 on Linux and macOS. We will accept PRs related to Windows, but do not officially support it.

## API

The Gymnasium API models environments as simple Python `env` classes. Creating environment instances and interacting with them is very simple- here's an example using the "CartPole-v1" environment:

```python
import gymnasium as gym
env = gym.make("CartPole-v1")

observation, info = env.reset(seed=42)
for _ in range(1000):
    action = env.action_space.sample()
    observation, reward, terminated, truncated, info = env.step(action)

    if terminated or truncated:
        observation, info = env.reset()
env.close()
```

## Notable Related Libraries

Please note that this is an incomplete list, and just includes libraries that the maintainers most commonly point newcomers to when asked for recommendations.

* [CleanRL](https://github.com/vwxyzjn/cleanrl) is a learning library based on the Gymnasium API. It is designed to cater to newer people in the field and provides very good reference implementations.
* [PettingZoo](https://github.com/Farama-Foundation/PettingZoo) is a multi-agent version of Gymnasium with a number of implemented environments, i.e. multi-agent Atari environments.
* The Farama Foundation also has a collection of many other [environments](https://farama.org/projects) that are maintained by the same team as Gymnasium and use the Gymnasium API.

## Environment Versioning

Gymnasium keeps strict versioning for reproducibility reasons. All environments end in a suffix like "-v0".  When changes are made to environm

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `v1.3.0` | 2026-04-22 | High | # Gymnasium v1.3.0  This release brings a new Taxi environment version, a new `RepeatAction` wrapper, and a range of bug fixes across vector environments and wrappers.  ## Core Changes * The `Taxi` environment has been updated to `v4` to correct the `is_rainy` implementation, which previously did not behave as documented by @pseudo-rnd-thoughts (https://github.com/Farama-Foundation/Gymnasium/pull/1561) * `pygame` has been replaced with [`pygame-ce`](https://pyga.me/), unlocking Python 3.14 |
| `1.2.3` | 2026-04-21 | Low | Imported from PyPI (1.2.3) |
| `v1.2.3` | 2025-12-18 | Low | ## Gymnasium V1.2.3  This is a minor release with the most significant being changing the dependency  for "gymnasium[box2d]" from [box2d-py](https://pypi.org/project/box2d-py) to [box2d](https://pypi.org/project/Box2D/). See https://github.com/Farama-Foundation/Gymnasium/pull/1474 for more detail.   Additionally, we're fixed several typos and added a couple of third-party projects. Lastly, we fixed the create an environment tutorial to use NumPy [row, col] in https://github.com/Farama-Founda |
| `v1.2.2` | 2025-11-04 | Low | # Gymnasium v1.2.2  This is a minor update just to add `Discrete.dtype` and improve `DictInfoToList`  These additional changes were made * Add `Discrete.dtype` parameter by @VadimBim in https://github.com/Farama-Foundation/Gymnasium/pull/1467 * Improve `MultiDiscrete.dtype` by @pseudo-rnd-thoughts in https://github.com/Farama-Foundation/Gymnasium/pull/1469 * Improve `DictInfoToList` to support vector info with missing binary key by @pseudo-rnd-thoughts in https://github.com/Farama-Foundat |
| `v1.2.1` | 2025-09-23 | Low | # Gymnasium v1.2.1  Minor update that adds new wrappers, optimizes several environment functions and fixes several bugs.  ## New Features * Added new wrappers to discretize observations and actions (`gymnasium.wrappers.DiscretizeObservation` and `gymnasium.wrappers.DiscretizeAction`) by @sparisi (https://github.com/Farama-Foundation/Gymnasium/pull/1411) * Add vector-based `RecordVideo` wrapper that allows recording all sub-environments at the same time by @sparisi (https://github.com/Faram |
| `v1.2.0` | 2025-06-27 | Low | # Gymnasium v1.2.0  In Gym [v0.24](https://github.com/openai/gym/releases/tag/0.24.0), v4 MuJoCo environments were added that used a different simulator (mujoco, not mujoco-py). Having been 3 years since v0.24 and with mujoco-py being unmaintained, it is limiting our ability to support Python 3.13.  Therefore, in this release, we have moved the MuJoCo v2 and v3 to the [Gymnasium-Robotics](https://github.com/Farama-Foundation/gymnasium-robotics) project, meaning the users who cannot upgrade t |
| `v1.1.1` | 2025-03-06 | Low | ## Changes  * Remove assert on metadata render modes for MuJoCo-based environments in `mujoco_env.py` (https://github.com/Farama-Foundation/Gymnasium/pull/1328) * Update `wrappers.vector.NumpyToTorch` to refer to `numpy` instead of `jax`  by @pkuderov in https://github.com/Farama-Foundation/Gymnasium/pull/1319  **Full Changelog**: https://github.com/Farama-Foundation/Gymnasium/compare/v1.1.0...v1.1.1 |
| `v1.1.0` | 2025-02-26 | Low | # Gymnasium v1.1  In this release, we fix several bugs with Gymnasium v1.0 along with new features to improve the changes made.  With the release of Gymnasium v1.0, one of the major changes we made was to the vector environment implementation, improving how users interface with it and extend it. Some users noted that they required backward compatibility with how vector environments automatically reset sub-environments when they terminated or truncated, referred to as the autoreset mode or AP |
| `v1.0.0` | 2024-10-08 | Low | # v1.0.0 release notes  Over the last few years, the volunteer team behind Gym and Gymnasium has worked to fix bugs, improve the documentation, add new features, and change the API where appropriate so that the benefits outweigh the costs. This is the complete release of `v1.0.0`, which will be the end of this road to change the project's central API (`Env`, `Space`, `VectorEnv`). In addition, the release has included over 200 PRs since `0.29.1`, with many bug fixes, new features, and improved |
| `v1.0.0a2` | 2024-05-21 | Low | This is our second alpha version which we hope to be the last before the full Gymnasium v1.0.0 release. We summarise the key changes, bug fixes and new features added in this alpha version.   ## Key Changes  ### Atari environments [ale-py](https://github.com/Farama-Foundation/Arcade-Learning-Environment) that provides the Atari environments has been updated in v0.9.0 to use Gymnasium as the API backend. Furthermore, the pip install contains the ROMs so all that should be necessary for insta |

## Citation

- HTML: https://www.freshcrate.ai/projects/gymnasium
- Markdown: https://www.freshcrate.ai/projects/gymnasium.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/gymnasium/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
