Skip to main content
JupyterLab works seamlessly with Pixi, providing a powerful environment for interactive computing and data science.

Basic Setup

1

Initialize Pixi Workspace

2

Add JupyterLab

3

Start JupyterLab

JupyterLab will open in your browser, ready to use with all dependencies from your Pixi environment.
A complete example is available in the Pixi repository.

Adding Scientific Packages

Install additional packages for data science and visualization:
These packages are immediately available in your Jupyter notebooks.

Available Kernels

JupyterLab supports multiple programming languages through kernels. Install additional kernels from conda-forge:

Bash Kernel

bash_kernel - Execute bash commands in notebooks

C++ Kernels

Other Language Kernels

Advanced Usage: Per-Directory Environments

Use pixi-kernel to run a single JupyterLab instance while using different Pixi environments for different notebooks.

Installation

1

Create Workspace

2

Add Packages

3

Start JupyterLab

How It Works

pixi-kernel automatically searches for a manifest file (pixi.toml or pyproject.toml) in:
  1. The notebook’s directory
  2. Any parent directory
When found, it uses that environment’s dependencies to run the notebook. JupyterLab launcher showing Pixi Kernel JupyterLab launcher showing Pixi Kernel

Example Structure

Each notebook automatically uses its directory’s Pixi environment.

Configuration Examples

Data Science Environment

pixi.toml

Multi-Language Environment

pixi.toml

Machine Learning Environment

pixi.toml

JupyterLab Extensions

Install useful JupyterLab extensions:

Best Practices

Lock Dependencies

Commit pixi.lock to ensure all collaborators use identical package versions.

Separate Environments

Use pixi-kernel to isolate project dependencies while sharing JupyterLab.

Version Control Notebooks

Use nbstripout to remove notebook outputs before committing:

Task Shortcuts

Define tasks in pixi.toml for common commands:

Working with Remote Servers

Run JupyterLab on a remote server and connect from your local machine:

On Remote Server

On Local Machine

Open http://localhost:8888 in your local browser.

Jupyter Notebook vs JupyterLab

Both interfaces work with Pixi:
JupyterLab offers a more modern interface with better extension support.

Troubleshooting

Kernel Not Found

Ensure the kernel package is installed:
Restart JupyterLab after adding kernels.

Import Errors

Verify the package is in your Pixi environment:

Port Already in Use

Specify a different port:

pixi-kernel Not Working

Check that a pixi.toml or pyproject.toml exists in the notebook’s directory or a parent directory.

Additional Resources