Using Jupyter in a Project
Run Jupyter with access to your project’s virtual environment:Importing Project Dependencies
Within a notebook, you can import your project’s modules directly:Creating a Kernel
For projects requiring package installation from notebooks, create a dedicated kernel:Installing Packages with a Kernel
Once the kernel is configured, install packages from within notebooks:Without a Kernel
You can still install packages without creating a kernel, but with some caveats:Using uv add
Using uv pip install
Using pip Magic with Seed Environment
For notebooks using the%pip magic:
Standalone Jupyter
Run Jupyter without a project for ad-hoc analysis:Non-Project Virtual Environments
Use Jupyter in a virtual environment without a project structure:- macOS and Linux
- Windows
VS Code Integration
Use Jupyter notebooks within VS Code with uv-managed projects:Installing Packages in VS Code
For full environment manipulation, add uv as a dev dependency:VS Code requires
ipykernel in the project environment. If you prefer not to add it as a dev dependency, install it directly: uv pip install ipykernelCommon Workflows
Data Science Project
Quick Exploration
Reproducible Research
Best Practices
- Use kernels for projects requiring package installation from notebooks
- Pin Jupyter version in
pyproject.tomlfor reproducibility - Use
uv addto ensure dependencies are tracked in your project - Avoid
%pip magicunless using a seeded environment - Add ipykernel as a dev dependency for VS Code compatibility
- Create kernel per project to avoid environment conflicts