# Installation

## System Dependencies

```bash
# uv - fast Python package manager (handles Python 3.12+ automatically)
curl -LsSf https://astral.sh/uv/install.sh | sh

# swig - required for Box2D environments (LunarLander, BipedalWalker)
brew install swig        # macOS
# apt-get install -y swig  # Linux/WSL
```

{% hint style="info" %}
**Windows:** Use [WSL2](https://docs.microsoft.com/en-us/windows/wsl/install) and follow Linux instructions.
{% endhint %}

## Install SLM Lab

```bash
# Clone
git clone https://github.com/kengz/SLM-Lab.git
cd SLM-Lab

# Install
uv sync
uv tool install --editable .

# Verify
slm-lab --help                                 # list all commands
slm-lab run --help                             # options for run command

# Troubleshoot: if slm-lab not found, use uv run
uv run slm-lab --help
```

### MuJoCo Playground

To use [MuJoCo Playground](https://google-deepmind.github.io/mujoco_playground/) environments (JAX/MJWarp GPU-accelerated simulation with 54 environments):

```bash
uv sync --group playground
```

This adds JAX, MuJoCo Playground, and MJWarp dependencies. Requires a CUDA GPU for GPU-accelerated simulation.

### Minimal Install

For [remote training](/slm-lab/using-slm-lab/remote-training.md) in the cloud with [dstack](https://dstack.ai), a minimal installation without ML dependencies is available:

```bash
git clone https://github.com/kengz/SLM-Lab.git
cd SLM-Lab
uv sync --no-default-groups
uv tool install dstack
```

## Docker

For containerized runs without local setup, use the [prebuilt image](https://github.com/kengz/SLM-Lab/pkgs/container/slm-lab):

```bash
docker pull ghcr.io/kengz/slm-lab:latest
docker run -it ghcr.io/kengz/slm-lab:latest uv run slm-lab --help
docker run -v $(pwd)/data:/app/data ghcr.io/kengz/slm-lab:latest \
    uv run slm-lab run slm_lab/spec/benchmark/ppo/ppo_cartpole.json ppo_cartpole train
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://slm-lab.gitbook.io/slm-lab/setup/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
