Quick Start¶
Installation¶
Python 3.8+ is required but we recommend Python 3.10 (later Python versions may not be supported).
Installation with conda¶
Install conda, e.g., via anaconda.
Clone the repo:
git clone https://github.com/sacktock/MASA-Safe-RL.git
cd MASA-Safe-RL
Create a conda virtual environment:
conda env create --name masa --file conda-environment.yaml
conda activate masa
Install dependencies:
pip install -e .
Installation with uv¶
uv sync installs the base package from the repository root.
For building docs, use
uv sync --group docsfrom the repository root.Adding GPU support for Jax:
uv sync --group cuda12(orcuda13if supported by your device)All groups (docs and GPU support):
uv sync --all-groups.
Installation with PyPI¶
Coming soon!
Enabling GPU Acceleration with JAX (Optional)¶
MASA-Safe-RL relies on JAX for GPU acceleration. If you are only interested in the gymnasium wrappers and constraints API then you do not need to complete the following steps.
Linux x86_64/aarch64: jax and jaxlib
0.4.30should already be installed via therequirements.txt. You need to reinstall JAX based on your cuda driver compatibility. Do not use the-Uoption here!
pip install "jax[cuda13]"
or
pip install "jax[cuda12]"
Windows: GPU acceletartion is also supported (experimentally) on Windows WSL x86_64. We strongly recommend using Ubuntu 22.04 or similar. You need to reinstall JAX based on your cuda driver compatibility. Do not use the
-Uoption here!
pip install "jax[cuda13]"
or
pip install "jax[cuda12]"
MAC: we recommend JAX with CPU. No further action is required if you correctly followed the earlier steps.
uv¶
Alternatively with uv,
uv sync --group cuda12
uv sync --group cuda13
Testing Your Installation¶
You can test your installation of masa via the command line,
python -m masa.run --env-id mini_pacman --algo q_learning --custom-cfgs mini_pacman --seed 0
Next Steps¶
Core Concepts - Familiarize yourself with the core concepts in MASA.
Basic Usage - Learn how to use MASA.