If you use Python + VS Code for ML, data science, or experiments, you probably have this problem:
Which Python environment is my notebook actually using?
Global Jupyter.
Random pip install.
Multiple virtualenvs.
Broken kernels.
There’s a much cleaner setup:
uv + Jupyter + VS Code.
uv run --with jupyter --with pandas --with matplotlib jupyter labThat's it.
uv creates a temporary isolated environment and throws it away afterward.
uv init --python 3.12
uv add --dev jupyterlab ipykernel
uv add pandas numpy matplotlib
uv run jupyter labNow your project owns:
pyproject.toml
uv.lock
.venv/
No global Python dependencies.
uv run ipython kernel install \
--user \
--env VIRTUAL_ENV $(pwd)/.venv \
--name=my-projectThen:
VS Code → Select Kernel → my-project
Done.
Your notebook uses the same environment as your project.
Instead of:
!pip install seabornUse:
!uv add seabornpyproject.toml and uv.lock stay in sync.
uv init
↓
uv add dependencies
↓
uv run jupyter
↓
Select kernel in VS Code
↓
Start experimenting
No global Jupyter. No dependency guessing. No environment roulette.
If you're using uv already, this is probably the simplest way to make Jupyter feel like a first-class part of your Python project.