Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Pixi

Overview

Pixi is a modern Python package management tool, replacing / improving on conda and mamba.

Installation, Update and Uninstall

Follow the instructions on: https://pixi.prefix.dev/latest/installation/

The installation script will add Pixi to the path.

Update

pixi self-update

Uninstall

pixi clean cache

# remove environments from pixi workspaces
cd path/to_workspace
pixi clean

# remove pixi executable
rm -r ~/.pixi

# remove pixi binary from `PATH`
...

Setup

Global environments

pixi global install \ 
    --environment data-science \ 
    --expose ds-python=python \
    pandas polars geopandas statsmodels \
    scikit-learn lightgbm xgboost catboost \
    matplotlib seaborn plotly streamlit \
    pydantic openpyxl fastexcel ipykernel ipywidgets tqdm

Jupyter Lab

Detailed instructions how to setup a global JupyterLab installation: README.md

Workspaces

Workspaces enable reproducible environments inside a folder (e.g. root of a Git repository).

# Create workspace inside existing folder:
pixi init

# Create workspace in a new folder
pixi init my_new_project

Adding dependencies

pixi add polars pytest

# add package from PyPI instead of conda-forge:
pixi add --pypi geopy 

# add local editable package as pypi dependency:
pixi add --pypi "project @ file:///absolute/path/to/project" --editable

# add package from github as pypi dependency:
pixi add --git https://github.com/username/my_package.git my_package --pypi

Update workspace environment

pixi update --dry-run # preview

pixi update

pixi.lock

Commit and track pixi.lock if you want reproduce the exact environment.

Rebuild environment from lockfile:

pixi clean # removes workspace environment under .pixi
pixi install --locked # recreates environment from lockfile

Resources