Jupyter Notebook

IPython

Cheatsheet

Jupyter set up

  • Installation

    brew install jupyterlab

    This will provide the jupyter cli.

Display Jupyter config paths

jupyter --paths

Output:

config:
    /home/takechiyo/workspace/gitlab/exam.NCA-GENL/.venv/etc/jupyter
    /home/takechiyo/.jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /home/takechiyo/workspace/gitlab/exam.NCA-GENL/.venv/share/jupyter
    /home/takechiyo/.local/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /home/takechiyo/.local/share/jupyter/runtime

Convert Jupyter Notebook to Python script

jupyter nbconvert --to script "$notebook.ipynb"

Open a Jupyter Notebook on GitHub or other hosted repos

Create a IPython Kernel

If you need to install packages from within the notebook, we recommend creating a dedicated kernel for your project.

Kernels enable the Jupyter server to run in one environment, with individual notebooks running in their own, separate environments.

uv run ipython kernel install --user --env VIRTUAL_ENV $(pwd)/.venv --name=$project_name

Notebook Version Control

Python

Issues

  • Bokeh plots note able to load

    • Trusting notebooks

      Depending on the version of the Notebook in use, it may be necessary to “trust” the notebook in order for Bokeh plots to re-render when the notebook is closed and subsequently re-opened. The “Trust Notebook” option is typically located under the “File” menu.

Deployment

JupyterLab

Successor to Jupyter Notebook, with more features

JupyterHub

JupyterHub allows you to host multiple instances of a single-user Jupyter notebook server.

Deployment - Docker

Deployment - Kubernetes

Deployment - Managed Services