7.1 Jupyter Notebooks

Overview

Jupyter Notebooks provide an interactive computing environment for data science, machine learning, and research. This guide covers installation and setup across different platforms.

What You’ll Learn

  • Installing Jupyter via Conda or pip
  • Running Jupyter on remote workspaces
  • Accessing Jupyter through your browser
  • Platform-specific considerations

Prerequisites

  • A running workspace or VM with terminal access
  • Python 3.8+ installed
  • Network access configured (ports open for web access)

Installation Methods

Conda provides the cleanest installation with dependency management.

# Install Miniconda (if not already installed)
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

# Create environment with Jupyter
conda create -n jupyter-env python=3.10 jupyterlab -y
conda activate jupyter-env

Option 2: Using pip

# Install in a virtual environment
python3 -m venv ~/jupyter-env
source ~/jupyter-env/bin/activate
pip install jupyterlab

Running Jupyter

Start the Server

# Start JupyterLab (recommended)
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser

# Or classic Jupyter Notebook
jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser
Warning

The --ip=0.0.0.0 flag allows remote connections. Ensure your security groups/firewall only allow trusted IPs.

Access in Browser

After starting, Jupyter displays a URL with a token:

http://127.0.0.1:8888/lab?token=abc123...

Replace 127.0.0.1 with your workspace’s IP address or hostname.


Platform-Specific Setup

Compute Service

Note

Compute Service workspaces may require security group updates to allow access on port 8888. See Managing Workspaces for instructions.

AWS (Direct Console)

Azure


Configuration

Instead of using tokens, set a password for easier access:

jupyter lab password

Jupyter Config File

Generate and customize the config:

jupyter lab --generate-config

Edit ~/.jupyter/jupyter_lab_config.py:

c.ServerApp.ip = '0.0.0.0'
c.ServerApp.port = 8888
c.ServerApp.open_browser = False

Running as a Service

To keep Jupyter running after disconnecting:

Using Screen

screen -S jupyter
jupyter lab --ip=0.0.0.0 --port=8888 --no-browser
# Press Ctrl+A, then D to detach

Using systemd (Linux)


Installing Kernels

Additional Python Environments

conda create -n myproject python=3.10
conda activate myproject
pip install ipykernel
python -m ipykernel install --user --name=myproject

R Kernel

conda install -c conda-forge r-irkernel

Troubleshooting

Issue Solution
Can’t connect to Jupyter Check security group allows port 8888 from your IP
Token expired Restart Jupyter or set a password
Kernel dies Check memory usage; may need larger instance
Package not found Ensure correct conda environment is activated

Next Steps