--- id: stable-baselines3 version: "2.9.0" license: MIT license_treatment: permissive maintenance: active --- # stable-baselines3 — Pytorch version of Stable Baselines, implementations of reinforcement learning algorithms. License: permissive · Maintenance: active · Downloads: 1.4M/mo ## What it is and what it does Stable Baselines3 is a collection of production-ready reinforcement learning algorithms implemented in PyTorch. It provides a unified, scikit-learn-inspired interface for training RL agents on Gymnasium environments, making it accessible for both researchers and practitioners. The library abstracts away low-level implementation details while maintaining flexibility for customization. The package is built on top of gymnasium, numpy, torch, and cloudpickle, handling the complexity of policy networks, value functions, and training loops so users can focus on environment design and hyperparameter tuning. It supports algorithms like PPO and DQN and is designed as a foundation for building new RL approaches or comparing novel methods against established baselines. Use it for: - Train a reinforcement learning agent on a custom or standard Gymnasium environment for robotics or game-playing tasks. - Establish a baseline for comparing new RL algorithms or techniques against well-tested implementations. - Prototype RL solutions quickly using pre-built algorithms without implementing training loops from scratch. - Conduct RL research with a modular, extensible codebase that separates policy, value, and environment concerns. - Deploy trained RL policies in production systems where reproducibility and reliability are critical. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Stable Baselines3 provides PyTorch implementations of reinforcement learning algorithms designed to work with Gymnasium environments, following a scikit-learn-like API for training and inference. Yes. Stable Baselines3 is actively maintained, has no known vulnerabilities, installs with low friction, and is widely used (top 5000 PyPI packages). It's the standard choice for RL practitioners who want reliable algorithm implementations without reinventing core components. Install it if you're training RL agents or need a trusted baseline for comparison. ## Install pip install stable-baselines3 uv add stable-baselines3 poetry add stable-baselines3 ## Installing stable-baselines3 Before you install: Low install friction with a pure-Python wheel and four runtime dependencies (gymnasium, numpy, torch, cloudpickle). The project is actively maintained with a recent release and high repository engagement (13690 stars), indicating stable ongoing support. License in practice: MIT license permits commercial and private use with minimal restrictions, making the package suitable for both research and production deployments without licensing concerns. Quickstart: pip install stable-baselines3 import gymnasium from stable_baselines3 import PPO env = gymnasium.make("CartPole-v1") model = PPO("MlpPolicy", env, verbose=1) model.learn(total_timesteps=10_000) action, _states = model.predict(env.reset()[0]) Requires PyTorch (torch) as a runtime dependency; ensure a compatible PyTorch installation is available for your system before importing. Verify before relying: - Whether pre-trained model checkpoints or zoo environments are available beyond the core library. - Performance characteristics and scalability limits for large-scale RL training tasks. - GPU acceleration requirements and CUDA compatibility details for torch-based training. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.4M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags reinforcement learning algorithms pytorch, RL policy training gymnasium, stable baselines PPO DQN, RL agent training framework, deep reinforcement learning baseline, gym environment policy learning, RL algorithm implementations, reinforcement-learning, pytorch, agent-training [View on SkillFed](https://skillfed.io/packages/stable-baselines3) · [View on PyPI](https://pypi.org/project/stable-baselines3/)