Skip to main content
Run Jupyter on the server and open it on your computer through an SSH tunnel. You get notebooks running on the GPU, and Jupyter stays private to you.
The commands on this page use the SSH config entry from your server’s Connect box, so <server-name> is all you need. Set it up first: see Save the connection once.
Don’t open Jupyter’s port to the internet, for example by adding a security group rule or running it on 0.0.0.0. Anyone who can reach it can run code on your server. The SSH tunnel below keeps it private.
1

Connect to your server

2

Install JupyterLab

The ready-made images with PyTorch preinstalled have a Python environment at /opt/pytorch. On those, install JupyterLab into it:
If this fails with Permission denied, your user isn’t in the sudo group yet. This affects servers created from the current PyTorch images, and the fix is to add yourself once, then reconnect and run the install again:
On any other image, create an environment first, then use ~/venv instead of /opt/pytorch in the commands on this page:
On Ubuntu, if python3 -m venv fails, install the venv module first with sudo apt install -y python3-venv.
3

Start JupyterLab

Still on the server, start it inside tmux, so Jupyter keeps running if your connection drops:
Jupyter prints a URL containing token=.... Copy it. To leave tmux running in the background, press Ctrl-b, then d.
4

Open the tunnel from your computer

In a new terminal on your own computer:
Leave it running. It forwards port 8888 on your computer to Jupyter on the server.
5

Open Jupyter in your browser

Paste the URL Jupyter printed, for example http://localhost:8888/lab?token=....

Check that the notebook sees the GPU

In a notebook cell:

Tips

  • If port 8888 is already used on your computer, pick another local port, for example ssh -N -L 9999:localhost:8888 <server-name>, and open http://localhost:9999.
  • To get back to Jupyter later, connect with ssh <server-name> and run tmux attach -t jupyter.
  • To use the same Python environment in your terminal, run source /opt/pytorch/bin/activate (or source ~/venv/bin/activate).
  • Notebooks are saved on the server’s disk. See Where your data lives.

SSH keys and connecting

Add a key, turn on SSH and connect.

Where your data lives

What is kept, what is lost, and how to save results.

Servers

Launch, connect, park and delete servers.

Deploy a model

Serve an open model behind an OpenAI-compatible API.