Practical overview
When it fits
Use Stable Baselines when you need its existing Python implementations for a reinforcement-learning experiment or to work with a project already based on the library. For a current version, follow the repository’s recommendation to Stable-Baselines3 and review its migration guide.
Who it is for
- Developers and researchers building or experimenting with reinforcement-learning agents.
- Practitioners comparing algorithm implementations in Gym-compatible environments.
- Developers maintaining older Stable Baselines projects who are considering the linked Stable-Baselines3 migration guide.
Documented uses
- Train an agent with a provided reinforcement-learning algorithm.
- Compare an algorithm against existing approaches in a Gym environment.
- Extend experiments with supported custom environments or policies.
- Review existing algorithm implementations when working on an older project.
Requirements & limits
The repository is public and identifies its license as MIT. Installation instructions use pip and list platform-specific system prerequisites for Ubuntu, macOS and Windows.
- The project is in maintenance mode; its README recommends Stable-Baselines3 for an up-to-date version.
- The documented TensorFlow range is 1.8.0 to 1.14.0; TensorFlow 2 API support is described as planned.
- The optional MPI installation enables DDPG, GAIL, PPO1 and TRPO.
- The README calls out custom environments and policies; callback support is listed for DQN, and TensorBoard support is described as rudimentary.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Stable Baselines with pip
Install the package after preparing the documented Python and system prerequisites.
Before you start
- Python 3.5 or later with development headers
- CMake, OpenMPI and zlib system packages
- TensorFlow 1.8.0 to 1.14.0
Steps
Install the listed system packages for your platform, following the repository instructions.
Run the command below to include the optional MPI dependency.
pip install stable-baselines[mpi]For an installation without MPI, run the command below instead.
pip install stable-baselines
Expected outcome
The Stable Baselines Python package is installed; the MPI option enables DDPG, GAIL, PPO1 and TRPO.
Guide limitations
- The README describes TensorFlow 1.8.0 to 1.14.0 support; TensorFlow 2 API support is described as planned.
- The repository labels the package as being in maintenance mode.
Train and run PPO2 on Gym CartPole
Use the repository’s documented Python example to train a PPO2 model and step it through CartPole-v1.
Before you start
- Stable Baselines installed
- Gym environment
CartPole-v1
Steps
Create the environment with
gym.make('CartPole-v1').Construct a PPO2 model using
MlpPolicyand the environment.Call
model.learn(total_timesteps=10000).Reset the environment, predict actions with the model, and pass them to
env.step.
Expected outcome
The example trains a PPO2 model and uses it to select actions in CartPole-v1.
Guide limitations
- The example assumes familiarity with reinforcement learning.
- The documented example does not establish compatibility with other Gym environments or policies.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 17 October 2026
- Original website title
- Stable-Baselines-Team/stable-baselines · Official homepage title · retained in its source language
Related options
Stable-Baselines3 — The repository recommends it as the up-to-date version and links to its migration guide. Migration compatibility and required changes are not specified here.

