Running Jupyter Notebooks

View as Markdown

Access JupyterLab on your GPU instance with port forwarding for interactive development with GPU acceleration.

Start JupyterLab

Connect to your instance and start JupyterLab:

$# Connect to your instance
$brev shell my-instance
$
$# Start JupyterLab (no browser on remote)
$jupyter lab --no-browser --port=8888

Copy the URL with token from the output (looks like http://localhost:8888/lab?token=...).

Forward the Port

In a new terminal window on your local machine:

$brev port-forward my-instance --port 8888:8888

Now open the Jupyter URL (with token) in your local browser: http://localhost:8888

Verify GPU Access

In a notebook cell, verify the GPU is available:

1import torch
2print(f"CUDA available: {torch.cuda.is_available()}")
3print(f"GPU: {torch.cuda.get_device_name(0)}")

Best Practices

  • Use jupyter lab --ip 0.0.0.0 if you need to access from external hosts
  • Run Jupyter in a tmux session to keep it running after disconnecting
  • Forward TensorBoard on port 6006 alongside Jupyter for experiment tracking

What’s Next