Skip to content

Jupyter Notebook

Deploy GPU instances with Jupyter Notebook pre-configured for interactive AI/ML development.

What's Included

Jupyter Environment:
  • Jupyter Notebook / JupyterLab
  • IPython kernel
  • GPU support enabled
Pre-installed Libraries:
  • PyTorch or TensorFlow (depending on environment)
  • NumPy, Pandas, Matplotlib, Seaborn
  • scikit-learn, SciPy
  • CUDA toolkit and GPU drivers
System:
  • Ubuntu 22.04 or 24.04 LTS
  • Python 3.9-3.11
  • pip and conda

Deploying Jupyter Environment

Select Environment

  1. Go to app.spheron.aiDeploy
  2. Choose your GPU (RTX 4090 recommended for development)
  3. Select OS:
    • Ubuntu 24.04 LTS ML Everything - Includes PyTorch + TensorFlow
    • Ubuntu 24.04 LTS ML PyTorch - PyTorch focused
    • Ubuntu 24.04 LTS ML TensorFlow - TensorFlow focused
  4. Deploy

Connect via SSH

ssh root@your-instance-ip

Starting Jupyter Notebook

Basic Setup

# Start Jupyter on all interfaces
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root
 
# Or with custom password
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='your-password'

Access Jupyter

From your browser:
http://your-instance-ip:8888

Get token (if not set custom password):

jupyter notebook list

Run in Background

# Using nohup
nohup jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root &
 
# Using screen
screen -S jupyter
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root
# Press Ctrl+A then D to detach

Configuration

Set Password

# Generate password
jupyter notebook password
 
# Or via config file
jupyter notebook --generate-config

Edit ~/.jupyter/jupyter_notebook_config.py:

c.NotebookApp.password = 'your-hashed-password'
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8888
c.NotebookApp.open_browser = False
c.NotebookApp.allow_root = True

Enable GPU in Notebooks

For PyTorch:
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU count: {torch.cuda.device_count()}")
print(f"GPU name: {torch.cuda.get_device_name(0)}")
For TensorFlow:
import tensorflow as tf
print(f"GPU devices: {tf.config.list_physical_devices('GPU')}")

Quick Examples

Create New Notebook

  1. Access Jupyter in browser
  2. Click NewPython 3
  3. Start coding

Install Additional Packages

# In notebook cell
!pip install transformers accelerate bitsandbytes
 
# Or from terminal
pip install package-name

Monitor GPU Usage

# In notebook
!nvidia-smi
 
# Or use gpustat
!pip install gpustat
!gpustat -i 1

Troubleshooting

Cannot access Jupyter in browser:
  • Verify Jupyter is running: ps aux | grep jupyter
  • Check port 8888 is open
  • Use instance public IP, not localhost
  • Verify token/password
GPU not detected in notebook:
# Check CUDA installation
!nvcc --version
!nvidia-smi
 
# Reinstall PyTorch with CUDA
!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
Notebook server crashed:
# Check logs
tail -f ~/.jupyter/*.log
 
# Restart Jupyter
pkill jupyter
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root
Port already in use:
# Use different port
jupyter notebook --ip=0.0.0.0 --port=8889 --no-browser --allow-root

Additional Resources