# How to Run a Jupyter Notebook with uv

When working with Jupyter notebooks, you should run them in isolated [environments](https://pydevtools.com/handbook/explanation/what-is-a-virtual-environment.md) to prevent dependency conflicts. [uv](https://pydevtools.com/handbook/reference/uv.md) provides several streamlined ways to do this.

## Using Jupyter with uv's Isolated Environments

To launch a Jupyter notebook with specific dependencies using uv:

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

This single command:
1. Creates a temporary environment
2. Installs Jupyter and your specified dependencies
3. Launches Jupyter Lab ready to use

No activation steps are required! If you're working within a project, uv will automatically incorporate your project's dependencies.

## Creating a Project-Specific Environment

For a more persistent setup:

```bash
# Create a new project directory
mkdir jupyter-project
cd jupyter-project

# Initialize a project
uv init --bare

# Add Jupyter and other dependencies
uv add --dev jupyter matplotlib pandas numpy
```

Then launch Jupyter within your project:

```bash
uv run jupyter lab
```

{{< callout type="tip" >}}
uv's automatic environment management eliminates most of the complexity traditionally associated with Jupyter and virtual environments.
{{< /callout >}}

## Learn more

- [uv: A Complete Guide](https://pydevtools.com/handbook/explanation/uv-complete-guide.md) covers what uv does, how fast it is, the core workflows, and recent releases.
