# Windows (WSL 2)

{% hint style="success" %}
**Updating RL Swarm to the CodeZero Environment**

Run `git pull`, then restart your swarm.

1. **Docker users:** Run `docker-compose run --rm --build -Pit swarm-cpu` or `docker-compose run --rm --build -Pit swarm-gpu`  &#x20;
2. **Script users:** Rebuild your venv by running: `rm -rf .venv && python -m venv .venv && source .venv/bin/activate`
   {% endhint %}

## Overview

This guide walks you through setting up RL Swarm on Windows using WSL 2 (Windows Subsystem for Linux).&#x20;

This allows you to run a native Linux environment compatible with Docker and Python, ensuring consistent results across platforms.

### Prerequisites

Make sure your system meets the minimum requirements and that you also have any additional dependencies installed.&#x20;

* A WSL 2 environment
* A 64-bit arm64 or x86 CPU with at least 32 GB RAM, or an officially supported NVIDIA GPU (3090, 4090, 5090, A100, H100)
* Python 3.10+
* [Docker](https://www.docker.com/) installed and configured
* Stable internet connection
* [Git](https://git-scm.com/install/) installed

### Installing WSL 2

1. Open **PowerShell** as Administrator.
2. Install WSL using the following command:

```bash
wsl --install
```

3. Restart your computer when prompted.
4. After reboot, open the Microsoft Store and install Ubuntu.
5. Launch Ubuntu and set up a username and password when prompted.

### Installing Dependencies

Once your Ubuntu environment is installed and open, install the required system dependencies.

Run the following commands one at a time to install Python, Docker, Git, and supporting packages:

```bash
sudo apt update
```

```bash
sudo apt install -y python3 python3-venv python3-pip curl wget git docker.io build-essential
```

#### Docker

Make sure you have Docker installed and the Docker daemon is running on your machine. To do that, follow [these instructions](https://docs.docker.com/get-started/get-docker/) according to your OS. Make sure you allot sufficient memory to the Docker containers.&#x20;

For example, if you are using Docker Desktop, this can be done by going to **Docker Desktop Settings > Resources > Advanced > Memory Limit**, and increasing it to the *maximum* possible value.

If you installed Docker via the command line, you can start it and spin up containers by running:

```bash
sudo service docker start
```

#### Clone the RL Swarm Repository

1. Navigate to your home directory in your WSL 2 environment and clone the RL Swarm GitHub repository using this command:

```bash
git clone https://github.com/gensyn-ai/rl-swarm.git
```

2. Then move into the project folder:

```bash
cd rl-swarm
```

{% hint style="info" %}
WSL paths differ from Windows (e.g., /home/user vs C:\Users\\). Make sure to double-check all filepaths if you're not copy-pasting from this guide.
{% endhint %}

#### Run RL Swarm

Depending on your hardware, you can run RL Swarm in either **CPU** or **GPU** mode.

{% tabs %}
{% tab title="CPU-Only" %}
For CPU-only setup (the default on most Windows machines):

```bash
docker compose run –rm –build -Pit swarm-cpu
```

{% endtab %}

{% tab title="GPU-Only" %}
For GPU-enabled setup (requires WSL and an NVIDIA GPU):

```bash
docker compose run –rm –build -Pit swarm-gpu
```

{% hint style="warning" %}
GPU support requires NVIDIA drivers and WSL integration enabled in Docker Desktop.
{% endhint %}
{% endtab %}
{% endtabs %}

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FJylnfEDauK6g57P2KET2%2Frl_swarm_initial_spin_up.png?alt=media&#x26;token=fb157527-d254-4b2d-a9b2-c056e2ffdb1d" alt=""><figcaption></figcaption></figure></div>

{% hint style="warning" %}
If you encounter an error saying “`docker-compose: command not found`”, use “`docker compose`” (without the hyphen) instead.
{% endhint %}

#### Log into RL Swarm

When you start RL Swarm, it will open a browser window automatically pointing to `http://localhost:3000.`

{% hint style="info" %}
If the browser does not open automatically, navigate to that address manually.
{% endhint %}

You will see the RL Swarm login screen powered by Alchemy. From here, you can log in using your preferred method such as Google or email.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2F0lf6tpSRK93cS66x44WY%2Fgensyn_login_screen.png?alt=media&#x26;token=61cb7cac-ef06-4cc1-88d8-ed651988ac40" alt=""><figcaption></figcaption></figure></div>

After login, a `swarm.pem` file will be created in your repository folder. This identifies your peer on the Gensyn Testnet.

***

### Joining the new RL-Swarm Environment (CodeZero)

#### Updating via git pull

First, start by running `git pull` to fetch the latest changes to RL Swarm.&#x20;

#### Launching after Updating

There are two launch paths.

1. **Launching with Docker:** If you are using Docker, you can restart your swarm after updating via `git pull` by using one of the two following commands:

```bash
docker-compose run --rm --build -Pit swarm-cpu
docker-compose run --rm --build -Pit swarm-gpu
```

2. **Launching with Shell Script:** If you are using the `run_rl_swarm.sh` script, you must remove your old virtual environment and create a fresh one:

```bash
rm -rf .venv
python -m venv .venv
source .venv/bin/activate
/run_rl_swarm.sh
```

{% hint style="success" %}
In both cases, restart your swarm after updating.
{% endhint %}

***

#### Huggingface

If you would like to upload your model to Hugging Face, enter your Hugging Face access token when prompted. You can generate one from your Hugging Face account, under [Access Tokens](https://huggingface.co/docs/hub/en/security-tokens).

#### Verify your Node

Once you are logged in, your node will begin training automatically.

You can verify that your peer has successfully connected by visiting the [Gensyn Testnet Dashboard.](https://dashboard.gensyn.ai/) Your peer should appear in the active swarm list, and you can monitor training progress in real time.

<div data-with-frame="true"><figure><img src="https://1034405018-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIcazOdplbOmP4R0T7sG8%2Fuploads%2FDWHs4gYzjRqDnRQyjz8z%2Fimage.png?alt=media&#x26;token=5f706d42-3174-4469-9fef-1ee3c17fda80" alt=""><figcaption></figcaption></figure></div>

#### Optional: Experimental Mode (No Docker)

If you want to experiment with the [GenRL](https://github.com/gensyn-ai/genrl) library or the [configurable parameters](https://github.com/gensyn-ai/rl-swarm/blob/main/rgym_exp/config/rg-swarm.yaml), we recommend you run RL Swarm via shell script:

```
python3 -m venv .venv
source .venv/bin/activate
./run_rl_swarm.sh
```

{% hint style="info" %}
This method gives you access to GenRL’s configuration parameters and experimental features.
{% endhint %}

To learn more about experimental mode, check out our [getting started guide](https://github.com/gensyn-ai/genrl/blob/main/getting_started.ipynb) on Github.

### Troubleshooting

Refer to the multi-platform [RL Swarm Troubleshooting guide](https://docs.gensyn.ai/testnet/rl-swarm/troubleshooting) for unblocking information and fixes to common set-up issues.

{% hint style="success" %}
If you need additional support, you can [open a ticket](https://github.com/gensyn-ai/rl-swarm/issues) or [visit our Discord.](https://discord.com/invite/gensyn)
{% endhint %}
