# How to Run a Jupyter Notebook with uv

[uv](https://pydevtools.com/handbook/reference/uv.md) gives two ways to run Jupyter: a temporary [environment](https://pydevtools.com/handbook/explanation/what-is-a-virtual-environment.md) for one-off sessions, or a project-tracked environment for reproducible notebooks.

## Launch Jupyter in a temporary environment

```bash
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

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

The `--dev` flag marks Jupyter as a {{< term "dev-dependency" "development dependency" >}}, keeping it out of production installs. The lockfile pins exact versions, so anyone cloning the project runs `uv sync` to get the same environment.

{{< callout type="tip" >}}
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](https://pydevtools.com/handbook/how-to/how-to-fix-modulenotfounderror-no-module-named-x.md) shows how to diagnose from inside a cell.
{{< /callout >}}
