# Develop in JupyterLab

> Develop in notebooks on a dedicated GPU, with work that survives restarts.

This example deploys a GPU instance from the PyTorch template with JupyterLab turned on, opens it in your browser, and keeps your notebooks on a network volume so they survive a stop.

## What you need

- A token to protect JupyterLab, for example from `openssl rand -hex 24`.

## Step 1: Create a network volume

<tabs sync="interface">
<tabs-item label="Console">

Open the [Storage page](https://console.cloud.featherless.ai/storage), click **Create volume**, name it `notebooks`, set **Capacity** to `50`, and click **Create volume**.

</tabs-item>

<tabs-item label="CLI">

```bash
featherless-cloud volume create notebooks --gb 50 --wait
```

</tabs-item>
</tabs>

## Step 2: Deploy the instance

<tabs sync="interface">
<tabs-item label="Console">
<steps level="4">

#### Open the deploy page

Open the [Instances page](https://console.cloud.featherless.ai/instances) and click **Deploy instance**. Name the instance `jupyter`. Keep the **PyTorch (ROCm)** template.

#### Choose compute

Under **Compute**, choose a **GPU model** and **1 GPU**.

#### Mount the volume

Under **Network volumes**, click **Add network volume**, choose `notebooks`, and keep the mount path `/workspace`. JupyterLab opens in `/workspace`.

#### Expose JupyterLab's port

Under **Public ports**, enter `8888`.

#### Turn on JupyterLab

Under **Environment variables**, add:

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Value
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        ENABLE_JUPYTER
      </code>
    </td>
    
    <td>
      <code>
        true
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        JUPYTER_TOKEN
      </code>
    </td>
    
    <td>
      Your token
    </td>
  </tr>
</tbody>
</table>

#### Launch

Click **Review launch**, then **Launch instance**.

</steps>
</tabs-item>

<tabs-item label="CLI">

```bash
featherless-cloud instance create \
  --name jupyter \
  --template featherless/rocm-pytorch \
  --gpu-count 1 \
  --volume notebooks:/workspace \
  --port 8888 \
  --env ENABLE_JUPYTER=true \
  --env JUPYTER_TOKEN="$(openssl rand -hex 24)"
```

Keep the token you generated; you need it to sign in. `featherless-cloud instance get jupyter` prints the address of port 8888.

</tabs-item>
</tabs>

<warning>

Use an environment variable for `JUPYTER_TOKEN`, not a secret variable: JupyterLab reads it from the environment. Members of your organization can see it on the instance's **Details** tab. Without a token, anyone with the address can run code on your instance.

</warning>

## Step 3: Open JupyterLab

Once the instance is running, open its **Connect** tab and click the address listed for port `8888`. Enter your token on the login page.

To skip the login page, add the token to the address: `<address>/lab?token=<your-token>`.

The file browser shows the contents of `notebooks`. Check the GPU from a notebook cell; it prints `True` and the GPU's name:

```python
import torch
torch.cuda.is_available(), torch.cuda.get_device_name(0)
```

## Step 4: Stop when you're done

Stopping ends compute billing. Notebooks in `/workspace` stay on the volume; packages you installed with `pip` are on the container disk and are erased.

<tabs sync="interface">
<tabs-item label="Console">

Open the instance, click **Stop**, and confirm with **Stop instance**. Click **Start** to continue later.

</tabs-item>

<tabs-item label="CLI">

```bash
featherless-cloud instance stop jupyter
featherless-cloud instance start jupyter
```

</tabs-item>
</tabs>

To get your packages back after a stop, keep a `requirements.txt` on the volume and run `pip install -r /workspace/requirements.txt` after each start.

## Clean up

Delete the instance, then the volume if you no longer need its files:

```bash
featherless-cloud instance delete jupyter
featherless-cloud volume delete notebooks
```

## Next steps

<card-group>
<card icon="i-lucide-globe" title="Expose ports" to="/instances/ports">

How public ports work.

</card>

<card icon="i-lucide-folder-up" title="Transfer files" to="/storage/transfer-files">

Upload datasets to the volume.

</card>
</card-group>
