Jupyter Workflow
This chapter describes the recommended workflow for using JupyterLab on the server.
Overview
The workflow consists of five steps:
Create a Python virtual environment (only once).
Start a Jupyter server on the remote machine.
Create an SSH tunnel from the local machine.
Open JupyterLab in a local web browser.
Upload and execute notebooks.
Step 0: Create a Dedicated Jupyter Environment
This step is performed only once.
Create a virtual environment:
python3 -m venv ~/venvs/jupyter
Activate it:
source ~/venvs/jupyter/bin/activate
Install JupyterLab:
pip install jupyterlab
Verify the installation:
jupyter lab --version
Step 1: Start the Jupyter Server
Connect to the server:
ssh username@server.example.edu
Activate the environment:
source ~/venvs/jupyter/bin/activate
Launch JupyterLab:
jupyter lab --no-browser --ip=127.0.0.1 --port=8888
A message similar to the following will appear:
http://127.0.0.1:8888/lab?token=<TOKEN>
Keep this terminal open.
The Jupyter server will continue running in this session.
Step 2: Create an SSH Tunnel
Open a second terminal on your local computer.
Create a tunnel:
ssh -L 8888:127.0.0.1:8888 username@server.example.edu
After authentication, leave this terminal open.
The local port 8888 is now connected to the Jupyter server running on the remote machine.
Step 3: Open JupyterLab
Open a web browser and visit:
http://localhost:8888/tree
If prompted, paste the token displayed when the Jupyter server was started.
Alternatively, use the complete URL displayed by Jupyter:
http://127.0.0.1:8888/lab?token=<TOKEN>
You should now see the JupyterLab interface.
Step 4: Upload Files
JupyterLab provides a graphical interface for managing files.
To upload a notebook or script:
Open the file browser panel.
Navigate to the desired directory.
Click the
Upload Filesbutton.Select one or more files from your computer.
Wait until the upload completes.
Alternatively, files can be dragged directly into the file browser.
After the upload finishes, the files become immediately available on the server filesystem.
Opening Notebooks
Double-click a notebook file:
*.ipynb
to open it in JupyterLab.
Cells can be executed individually or sequentially.
Kernel Management
To restart a kernel:
Kernel → Restart Kernel
To interrupt a computation:
Kernel → Interrupt Kernel
Stopping Jupyter
Return to the terminal where Jupyter was launched.
Press:
Ctrl+C
and confirm the shutdown.