Skip to main content

VS Code and Jupyter

Work on your machine from VS Code with Remote-SSH, and open Jupyter and other web UIs on your computer through SSH port forwarding.

On this page

Only the SSH port reaches your machine from the internet. That's all you need: VS Code connects through SSH, and Jupyter or any other web UI on the machine is reached through an SSH tunnel to a port on your own computer. The examples use a Mac Studio on port 2211; use the port from your reservation page.

VS Code Remote-SSH

VS Code's Remote - SSH extension opens folders on the machine as if they were local, with a terminal, the debugger and your extensions running there.

  1. Add the machine to your SSH config, as in Using ~/.ssh/config:

    ssh-config
    Host gpu
        HostName ssh.gputorent.com
        Port 2211
        User renter
        IdentityFile ~/.ssh/id_ed25519
  2. In VS Code, install the Remote - SSH extension.

  3. Open the Command Palette and run Remote-SSH: Connect to Host…, then choose gpu. If VS Code asks for the platform, choose macOS for a Mac Studio or Linux for a DGX Spark.

  4. Choose Open Folder and pick your home folder, or a folder in it. That's where you can write.

VS Code installs its server in your home folder on the first connection, so the first connect of each reservation takes a little longer. Like everything else on the machine, it's erased at the end.

When a program on the machine starts listening on a port, VS Code usually offers to forward it, and lists it in its Ports panel. That's the same SSH port forwarding as below, done for you.

Jupyter through port forwarding

Install Jupyter in a virtual environment in your home folder and start it on the machine, inside tmux or with nohup so it keeps running if you disconnect (see Connecting):

bash
python3 -m venv ~/.venvs/jupyter
~/.venvs/jupyter/bin/pip install jupyterlab
~/.venvs/jupyter/bin/jupyter lab --no-browser --port 8888

Jupyter prints a URL with a token. Then, in a terminal on your computer, open the tunnel and leave it open while you work:

bash
ssh -p 2211 -N -L 8888:localhost:8888 renter@ssh.gputorent.com

Open http://localhost:8888 in your browser, or paste the URL Jupyter printed, which includes the token.

You can also skip the browser: with VS Code connected over Remote-SSH and its Python and Jupyter extensions, open a .ipynb file and pick a kernel from your virtual environment on the machine.

Other web UIs and APIs

Any server on the machine works the same way: Open WebUI, ComfyUI, TensorBoard, or an OpenAI-compatible model server such as mlx_lm.server on a Mac or vLLM on a DGX Spark. Start it on the machine, then forward its port. For a model API on port 8000:

bash
ssh -p 2211 -N -L 8000:localhost:8000 renter@ssh.gputorent.com

Your code on your computer then calls http://localhost:8000.

On a DGX Spark, a server in a container needs its port published with -p first, such as docker run -p 8000:8000 …, then forwarded the same way. See DGX Spark environment.

Forward several ports at once by repeating -L. For example, Jupyter and vLLM on a DGX Spark on port 2201:

bash
ssh -p 2201 -N -L 8888:localhost:8888 -L 8000:localhost:8000 renter@ssh.gputorent.com

Or put LocalForward lines in your SSH config, as in Port forwarding in the config.

Which port numbers to use

There are three different ports in play, and only one of them comes from us:

PortWhere it's usedWhat it is
SSH port, such as 2211-p 2211, or Port in the configYour machine's public SSH port, from the reservation page. Mac Studios use 2211, 2212 and so on; DGX Sparks 2201, 2202 and so on. Never 22.
Remote port, such as 8888The right-hand side of -L 8888:localhost:8888The port the server listens on, on the machine. Use one above 1024.
Local port, such as 8888The left-hand side of -L, and http://localhost:8888A free port on your computer. It can be the same number as the remote one, or any other free port.
  • If the local port is already in use on your computer, pick another one: -L 8889:localhost:8888 reaches Jupyter on the machine at http://localhost:8889.
  • localhost in the middle of -L means "the machine itself, as seen from the machine", so servers can stay bound to localhost there; nothing needs to listen on a public address.
  • On a Mac Studio, the remote desktop uses this pattern too, with local port 5901 for the machine's port 5900. See Remote desktop on a Mac Studio.
  • Opening a port to the internet isn't possible: only the SSH port reaches the machine. See What's allowed.