How to Reconnect to Your Jupyter Notebook (and Avoid Losing Work)
Written By chloe kwok
Last updated 10 months ago
Why Notebooks Become Inaccessible
The most common reasons are:
Exceeding CPU or RAM limits: If your notebook uses more memory than allocated, the session can crash or be terminated
Browser or network interruptions: Your notebook interface runs through your browser, so local issues (like Wi-Fi drops or browser crashes) can affect connectivity
Inactive sessions: If a session is idle for too long, it may be auto-terminated depending on platform settings
Reconnecting to Your Notebook
If your session drops or the browser disconnects:
Restart the session if needed: If the session was terminated, start a new one and reattach your storage volume to access saved files
Reload your browser: In some cases, refreshing the tab is enough to reestablish the connection
Use saved checkpoints or export history: If you enabled model checkpoints or regularly saved outputs to disk, you can easily resume work
Best Practices to Avoid Session Loss
1. Save Outputs to disk
Large plots or datasets held in memory can cause slowdowns or crashes. Save them to your attached volume with:
Exampleplt.savefig('/workspace/output/my_plot.png')2. Use Model Checkpoints
When training models, use built-in checkpointing (like PyTorch’s torch.save() or TensorFlow’s checkpoint manager) to periodically save progress.
This way, even if your session ends unexpectedly, you won’t have to start over.
3. Manage Memory Efficiently
Remove unused variables and clear memory during long sessions:
Exampledel big_tensor
import gc
gc.collect()4. Run Long Jobs via SSH
For long-running scripts or training loops, consider converting your notebook to a Python script and running it in the background using tools like screen or tmux via SSH:
Examplejupyter nbconvert --to script my_notebook.ipynb
ssh into your instance
screen
python my_notebook.pyThis keeps your job running even if your browser disconnects.
Still Having Issues?
If you’re still seeing disconnects or crashes after following these tips, reach out to our support team at [email protected] — we’re here to help.