Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Jupyter Notebooks are interactive documents that combine live code, equations, visualizations, and narrative text. They are the primary way most users work in GeoLab.

What is a Jupyter Notebook?

A notebook is made up of individual cells — each cell contains either executable code or formatted text (Markdown). You run cells one at a time, or all at once, and the output appears directly below each cell. This makes notebooks well-suited for exploratory data analysis, documentation, and sharing reproducible workflows.

Opening and Creating Notebooks

GeoLab uses JupyterLab, a browser-based IDE. When you first log in, you’ll land on the Launcher. From there, click Python 3 (ipykernel) under the Notebook heading to open a new, empty notebook.

There are several other ways to reach the Launcher:

To open an existing notebook, navigate to it in the File Browser (folder icon in the sidebar) and double-click the .ipynb file.

See Navigating GeoLab for a full tour of the JupyterLab interface.

Notebook Interface

When a notebook is open, you’ll see three main areas:

Notebook Interface

Cell Types

Code Cells

Code cells run Python (or whichever language your kernel supports). Click a cell to select it, then run it with Shift + Enter. Output appears immediately below.

print("Hello, GeoLab!")

Markdown Cells

Markdown cells contain formatted text — useful for explaining your workflow, adding section headers, and documenting results. Change a cell to Markdown using the dropdown in the toolbar, or press Esc then M when a cell is selected.

See this guide to Markdown Syntax to help you format your Markdown Cells.

Double-click a rendered Markdown cell to edit it. Run it again to render.

Keyboard Shortcuts

ShortcutAction
Shift + EnterRun cell, move to next
Ctrl + EnterRun cell, stay in place
EscEnter command mode
Esc then AInsert cell above
Esc then BInsert cell below
Esc then D, DDelete selected cell
Esc then MChange cell to Markdown
Esc then YChange cell to code
Ctrl + SSave notebook

For the full list, go to Help → Show Keyboard Shortcuts.

The Kernel

Notebooks don’t run quite like python scripts. In a Python script, the interpreter runs your code top-to-bottom and exits. In a notebook, a kernel is the persistent Python process running in the background while your notebook is open. The kernel remembers every variable, function, and import from every cell you’ve run, in whatever order you ran them. This is the most important conceptual difference from scripting: cell order on the page doesn’t matter; execution order does.

Kernel status

The kernel status indicator appears in the top-right corner of the notebook:

Each cell also shows its execution status in brackets on the left:

Interrupting a running cell

If a cell is taking too long or stuck in a loop, stop it with Kernel → Interrupt Kernel, or press I, I in command mode. This is the notebook equivalent of Ctrl+C in a terminal. Your variables are preserved.

Restarting the kernel

Restarting clears all variables and imports from memory, giving you a clean Python session. This is the fastest fix for unexpected behavior caused by running cells out of order.

ActionEffect
Kernel → Restart KernelClears memory; leaves cell outputs visible
Kernel → Restart Kernel and Clear All OutputsClears memory and output
Kernel → Restart Kernel and Run All CellsClears memory, then reruns the notebook top-to-bottom

Use Restart and Run All before sharing a notebook to confirm it runs correctly in order.

Shutting down kernels

Closing a notebook tab does not shut down the kernel — it keeps running in the background. When you’re done with a notebook, shut down its kernel explicitly:

Saving Your Work

Jupyter autosaves periodically, but you should save manually before closing a notebook: Ctrl + S, or File → Save Notebook.

Notebooks are saved to your /home/jovyan directory and will persist between sessions. See File Systems and Data Storage for storage limits and best practices.

Exporting Notebooks

To export a notebook to another format (HTML, PDF, etc.):

  1. File → Save and Export Notebook As...

  2. Select your desired format.

PDF export requires LaTeX to be available in your environment.

Best Practices

Troubleshooting

Unexpected errors or stale variable values Restart the kernel: Kernel → Restart Kernel. This clears all variables and lets you start fresh. Re-run your cells from the top.

Kernel appears stuck or unresponsive Try Kernel → Interrupt Kernel first. If that doesn’t work, restart the kernel.

Cluttered or very large cell output Right-click the output area and select Clear Output, or use Edit → Clear All Outputs. Suppress a cell’s outputs by adding %%capture to the beginning of the cell.

Wrong environment or missing packages Confirm you launched GeoLab with the correct environment. See Launching your Server.