# 2. Setup Environment

Before installing and configuring **Cifer's FedLearn**, it's important to properly prepare your environment. Follow these steps to ensure a smooth setup process:

## Update Python

Cifer requires **Python 3.8** or later. To check your Python version:

{% code title="bash" %}

```bash
python --version
```

{% endcode %}

If Python is not installed or you need to upgrade, download and install the latest version from [python.org](https://www.python.org/downloads/).

## Set Up a Virtual Environment&#x20;

It's recommended to use a virtual environment to avoid conflicts with other Python projects:

{% code title="bash" %}

```bash
python -m venv cifer_env
```

{% endcode %}

### Activate the virtual environment:

* **On Linux or macOS:**

{% code title="bash" %}

```bash
source cifer_env/bin/activate
```

{% endcode %}

* **On Windows:**

{% code title="bash" %}

```bash
cifer_env\Scripts\activate
```

{% endcode %}

## Upgrade pip

Ensure you have the latest version of pip:

{% code title="bash" %}

```bash
pip install --upgrade pip
```

{% endcode %}

### Check GPU/TPU Availability (Optional)

If you plan to use GPU or TPU acceleration:

**For NVIDIA GPUs:**

{% code title="bash" %}

```bash
nvidia-smi
```

{% endcode %}

**For TPUs (on Google Cloud):**

{% code title="bash" %}

```bash
gcloud compute tpus list
```

{% endcode %}

### Set Up Cloud Environment (for Collaboration Mode)

If you're planning to use FedLearn in collaboration mode:

1. Ensure you have access to a cloud platform (e.g., AWS, Google Cloud, Azure).
2. Set up firewall rules to allow communication on the required ports.
3. Prepare a shared storage solution for model checkpoints (e.g., S3, Google Cloud Storage).

### Prepare Your Dataset

Organize your dataset in a format compatible with FedLearn. Typically, this involves:

1. Splitting your data into training and validation sets.
2. Ensuring consistent file formats across all participating nodes.
3. Placing the data in a directory accessible to the FedLearn client.

### Review System Requirements

Double-check that your system meets all the requirements listed in the previous section, including RAM, storage, and any specific hardware needs.
