Requirements
PufferLib requires:- Python 3.9 or higher (supports 3.9-3.14)
- PyTorch (for training)
- NumPy < 2.0
- CUDA toolkit (optional, for GPU acceleration)
Basic installation
Install PufferLib from PyPI:- Ocean environments (custom C environments)
- Vectorization and parallel simulation
- PufferRL training system
- Gym, Gymnasium, and PettingZoo compatibility
The basic installation includes dependencies for training:
torch, psutil, nvidia-ml-py, rich, imageio, gpytorch, scikit-learn, heavyball, neptune, and wandb.Environment-specific dependencies
PufferLib supports 35+ environments through optional dependency groups. Install only what you need:Atari games
gymnasium[accept-rom-license], opencv-python, ale_py
Procgen
procgen-mirror (with Python 3.11+ support), stable_baselines3
NetHack
nle==0.9.1, gym, gymnasium
MiniGrid
minigrid==2.3.1, gym, gymnasium
Mujoco
gymnasium[mujoco], moviepy
PettingZoo environments
Other supported environments
PufferLib includes optional dependencies for:avalon- Avalon RL environmentbox2d- Box2D physics environmentsbsuite- DeepMind BSuitecrafter- Crafter survival gamecraftax- Craftax (JAX-based)dm_control- DeepMind Control Suitegriddly- Griddly grid worldkinetix- Kinetix environmentsminihack- MiniHack (NetHack variants)nmmo- Neural MMOpokemon_red- Pokemon Red GBvizdoom- ViZDoom FPS
Installing from source
For development or the latest features:Install in editable mode
Building from source requires build tools:
setuptools, wheel, Cython, numpy<2.0, and torch.CUDA extensions
PufferLib includes CUDA-accelerated kernels for advantage computation. These are automatically built if:- PyTorch is compiled with CUDA or ROCm support
- CUDA toolkit or ROCm is found on your system
Building without CUDA
If you don’t have CUDA but still want to install PufferLib:Force rebuild
To rebuild extensions after updating PyTorch or CUDA:Troubleshooting CUDA builds
If you encounter CUDA build errors:CUDA not found
CUDA not found
Ensure
nvcc is in your PATH:PyTorch/CUDA version mismatch
PyTorch/CUDA version mismatch
Verify your PyTorch installation matches your CUDA version:Install the correct PyTorch version from pytorch.org.
Build isolation issues
Build isolation issues
Some systems require disabling build isolation:
Compiler compatibility
Compiler compatibility
CUDA requires compatible GCC versions. For CUDA 11.x, use GCC 9 or 10:
Building Ocean environments
Ocean environments are PufferLib’s custom C-based environments. They’re built automatically during installation. To skip building Ocean environments:Verifying installation
Test your installation:Docker installation
For a pre-configured environment:Next steps
Quickstart
Train your first agent
Core concepts
Learn PufferLib fundamentals