Skip to content

How to Run a Jupyter Notebook with uv

uv gives two ways to run Jupyter: a temporary environment for one-off sessions, or a project-tracked environment for reproducible notebooks.

Launch Jupyter in a temporary environment

uv run --with jupyter --with pandas --with matplotlib jupyter lab

uv creates an isolated environment, installs Jupyter and the listed packages, and starts Jupyter Lab. No activation needed. Inside a project directory, uv includes your project dependencies automatically.

Add Jupyter to a project

uv init --bare
uv add --dev jupyter matplotlib pandas numpy
uv run jupyter lab

The --dev flag marks Jupyter as a development dependencyA package needed during development (testing, linting, formatting) that is not shipped to users of your project. Installed with the --dev flag. , keeping it out of production installs. The lockfile pins exact versions, so anyone cloning the project runs uv sync to get the same environment.

If a notebook cell raises ModuleNotFoundError for a package you installed, the kernel may be running in a different environment. How to fix ModuleNotFoundError: no module named X shows how to diagnose from inside a cell.
Last updated on