Skip to content

Quick Start

Installation

Python 3.10+ is required (3.10 recommended), later versions may 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 only base dependency package from the repository root.

Easiest way to install all dependencies: All dependency groups (docs and GPU support for CUDA13): uv sync --all-groups --no-group cuda12.

Alternatively, uv sync --all-groups --no-group cuda13 if your system only supports CUDA 12.

More minimal ways of installing dependency groups: * For building docs, use uv sync --group docs from the repository root. * Adding GPU support for Jax: uv sync --group cuda13 (or cuda12 if CUDA 13 is not supported by your device)

Installation with PyPI

MASA-Safe-RL is now available on PyPI: MASA-Safe-RL.

pip install -U MASA-Safe-RL

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.30 should already be installed via the requirements.txt. You need to reinstall JAX based on your cuda driver compatibility. Do not use the -U option 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 -U option 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 with the prebuilt CLI:,

masa run --env-id mini_pacman --algo q_learning --seed 0

Next Steps