freshcrate
Home > RAG & Memory > gymnasium

gymnasium

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

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

Release History

VersionChangesUrgencyDate
1.2.3Imported from PyPI (1.2.3)Low4/21/2026
v1.2.3## 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-FoundaLow12/18/2025
v1.2.2# 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-FoundatLow11/4/2025
v1.2.1# 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/FaramLow9/23/2025
v1.2.0# 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 tLow6/27/2025
v1.1.1## 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.1Low3/6/2025
v1.1.0# 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 APLow2/26/2025
v1.0.0# 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 improvedLow10/8/2024
v1.0.0a2This 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 instaLow5/21/2024
v1.0.0a1Over 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 such that the benefits outweigh the costs. This is the first alpha release of `v1.0.0`, which aims to be the end of this road of changing the project's API along with containing many new features and improved documentation. To install v1.0.0a1, you must use `pip install gymnasium==1.0.0a1` or `pip install --pre gymnasiuLow2/13/2024
v0.29.1A minimal release that fixes a warning produced by `Wrapper.__getattr__`. In particular, this function will be removed in v1.0.0 however the reported solution for this was incorrect and the updated solution still caused the warning to show (due to technical python reasons). ## Changes * The `Wrapper.__getattr__` warning reports the incorrect new function, `get_attr` rather than `get_wrapper_attr` * When using `get_wrapper_attr`, the `__getattr__` warning is still be raised due to `get_wrLow8/21/2023
v0.29.0# v0.29.0 Release notes We finally have a software citation for Gymnasium with the plan to release an associated paper after v1.0, thank you to all the contributors over the last 3 years who have made helped Gym and Gymnasium (https://github.com/Farama-Foundation/Gymnasium/pull/590) ``` @misc{towers_gymnasium_2023, title = {Gymnasium}, url = {https://zenodo.org/record/8127025}, abstract = {An API standard for single-agent reinforcement learning environments, with Low7/14/2023
v0.28.1# v0.28.1 Release notes Small emergency release to fix several issues * Fixed `gymnasium.vector` as the `gymnasium/__init__.py` as it isn't imported https://github.com/Farama-Foundation/Gymnasium/pull/403 * Update third party envs to separate environments that support gymnasium and gym and have a consistent style https://github.com/Farama-Foundation/Gymnasium/pull/404 * Update the documentation for v0.28 as frontpage gif had the wrong link, experimental documentation was missing and add Low3/25/2023
v0.28.0# v0.28.0 Release notes This release introduces improved support for the reproducibility of Gymnasium environments, particularly for offline reinforcement learning. `gym.make` can now create the entire environment stack, including wrappers, such that training libraries or offline datasets can specify all of the arguments and wrappers used for an environment. For a majority of standard usage (`gym.make(”EnvironmentName-v0”)`), this will be backwards compatible except for certain fairly uncommonLow3/24/2023
v0.27.1# Release Notes ## Bugs fixed * Replace `np.bool8` with `np.bool_` for numpy 1.24 deprecation warning by @pseudo-rnd-thoughts in https://github.com/Farama-Foundation/Gymnasium/pull/221 * Remove shimmy as a core dependency by @pseudo-rnd-thoughts in https://github.com/Farama-Foundation/Gymnasium/pull/272 * Fix silent bug in ResizeObservation for 2-dimensional observations. by @ianyfan in https://github.com/Farama-Foundation/Gymnasium/pull/230 and by @RedTachyon in https://github.com/FaraLow1/20/2023
v0.27.0# Release Notes Gymnasium 0.27.0 is our first major release of Gymnasium. It has several significant new features, and numerous small bug fixes and code quality improvements as we work through our backlog. There should be no breaking changes beyond dropping Python 3.6 support and remove the mujoco `Viewer` class in favor of a `MujocoRendering` class. You should be able to upgrade your code that's using Gymnasium 0.26.x to 0.27.0 with little-to-no-effort. Like always, our development roadLow12/12/2022
v0.26.3# Release Notes Note: ale-py (atari) has not updated to Gymnasium yet. Therefore `pip install gymnasium[atari]` will fail, this will be fixed in `v0.27`. In the meantime, use `pip install shimmy[atari]` for the fix. ## Bug Fixes * Added Gym-Gymnasium compatibility converter to allow users to use Gym environments in Gymnasium by @RedTachyon in https://github.com/Farama-Foundation/Gymnasium/pull/61 * Modify metadata in the `HumanRendering` and `RenderCollection` wrappers to have the correLow10/24/2022
v0.26.2This Release is an upstreamed version of [Gym v26.2](https://github.com/openai/gym/releases/tag/0.26.2) ### Bugs Fixes * As reset now returns (obs, info) then in the vector environments, this caused the final step's info to be overwritten. Now, the final observation and info are contained within the info as "final_observation" and "final_info" @pseudo-rnd-thoughts * Adds warnings when trying to render without specifying the render_mode @younik * Updates Atari Preprocessing such that the wrLow10/5/2022
v0.26.1This Release is an upstreamed version of [Gym v26.1](https://github.com/openai/gym/releases/tag/0.26.1) In addition, the [gym docs](https://github.com/farama-Foundation/gym-docs) repo has been merged in with the new website https://gymnasium.farama.org/Low9/16/2022
v0.26.0This is the first release of Gymnasium, a maintained fork of OpenAI Gym This release is identical to the Gym v0.26.0 except for the project name (Gymnasium) and Code of Conduct Read https://github.com/Farama-Foundation/Gymnasium/issues/12 for the roadmap of changesLow9/13/2022

Dependencies & License Audit

Loading dependencies...

Similar Packages

pytorch-lightningPyTorch Lightning is the lightweight PyTorch wrapper for ML researchers. Scale your models. Write less boilerplate.2.6.1
apache-tvm-ffitvm ffi0.1.10
outlines-coreStructured Text Generation in Rust0.2.14
magikaA tool to determine the content type of a file with deep learning1.0.2
xgrammarEfficient, Flexible and Portable Structured Generation0.1.33