Getting Started
|
Install pixi (macOS/Linux) curl -fsSL https://pixi.sh/install.sh | bash |
|
|
Install pixi (Windows) iwr -useb https://pixi.sh/install.ps1 | iex |
|
|
Create a new workspace pixi init <path> |
|
|
Create workspace with specific channels pixi init -c conda-forge -c bioconda <path> |
|
|
Create workspace with pyproject.toml format pixi init --format pyproject <path> |
|
|
Import from conda environment.yml pixi init --import environment.yml |
|
|
Create workspace for specific platforms pixi init -p linux-64 -p osx-arm64 <path> |
|
|
Quick start workflow pixi init hello-world cd hello-world pixi add python pixi run python -c 'print("Hello World!")' |
Dependencies
|
Add a conda dependency pixi add numpy |
|
|
Add a PyPI dependency pixi add --pypi requests |
|
|
Add an editable PyPI dependency pixi add --pypi --editable ./my-local-package |
|
|
Add a dependency for a specific platform pixi add -p linux-64 cuda-toolkit |
|
|
Add a dependency to a named feature pixi add -f dev pytest |
|
|
Add a build or host dependency pixi add --build cmake pixi add --host openssl |
|
|
Add a dependency from a git repository pixi add --pypi --git https://github.com/owner/repo --branch main pixi add --pypi --git https://github.com/owner/repo --tag v1.0.0 pixi add --pypi --git https://github.com/owner/repo --rev abc1234 |
|
|
Remove a dependency pixi remove numpy
pixi remove --pypi requests |
|
|
Update lockfile and environments pixi update pixi update numpy # update specific package pixi update -e dev # update specific environment pixi update --dry-run # preview changes without applying |
|
|
Upgrade package version constraints pixi upgrade
pixi upgrade numpy # upgrade specific package |
|
|
Control version pinning strategy pixi add numpy --pinning-strategy semver # options: semver | minor | major | latest-up | exact-version | no-pin |
Environments
|
Install the environment pixi install |
|
|
Reinstall the environment pixi reinstall |
|
|
Activate a shell inside the environment pixi shell pixi shell -e dev # activate a named environment exit # leave the pixi shell |
|
|
Run a command inside the environment pixi run python script.py pixi run -e dev pytest # run in a named environment |
|
|
Run a command without activating pixi tasks pixi run -x python script.py |
|
|
Run a command in an isolated environment pixi run --clean-env python script.py |
|
|
Execute a command in a temporary environment pixi exec cowsay hello pixi exec --spec python=3.12 python -c 'import sys; print(sys.version)' |
|
|
Clean environments pixi clean # remove all environments pixi clean cache # clean download cache |
|
|
Print the environment activation script pixi shell-hook pixi shell-hook -e dev eval "$(pixi shell-hook)" # activate in current shell |
Tasks
|
Add a task pixi task add test 'pytest tests/' pixi task add build 'cargo build --release' |
|
|
Add a task with dependencies # pixi.toml [tasks] build = "cargo build" test = { cmd = "cargo test", depends-on = ["build"] } |
|
|
Remove a task pixi task remove test |
|
|
Create a task alias pixi task alias t test |
|
|
List all tasks pixi task list |
|
|
Run a task pixi run test pixi run test --skip-deps # skip dependent tasks pixi run test --dry-run # preview without executing |
|
|
Define tasks in pixi.toml [tasks] start = "python main.py" test = { cmd = "pytest", depends-on = ["lint"] } lint = "ruff check ." format = { cmd = "ruff format .", cwd = "src" } |
Global Packages
|
Install a tool globally pixi global install ripgrep pixi global install ruff uv # multiple tools pixi global install 'python=3.12' # pinned version |
|
|
Uninstall a global tool pixi global uninstall ripgrep |
|
|
List globally installed tools pixi global list |
|
|
Update global tools pixi global update
pixi global update ripgrep # update specific tool |
|
|
Add a dependency to a global environment pixi global add -e my-env numpy |
|
|
Remove a dependency from a global environment pixi global remove -e my-env numpy |
|
|
Sync global manifest with installed environments pixi global sync |
|
|
Expose a binary from a global environment pixi global expose add --environment my-env my-binary |
|
|
Show dependency tree of a global environment pixi global tree
pixi global tree -e my-env |
|
|
Edit the global manifest file pixi global edit |
Workspace Management
|
Add or remove channels pixi workspace channel add bioconda pixi workspace channel remove bioconda pixi workspace channel list |
|
|
Manage platforms pixi workspace platform add win-64 pixi workspace platform remove win-64 pixi workspace platform list |
|
|
Manage environments pixi workspace environment add dev pixi workspace environment remove dev pixi workspace environment list |
|
|
Manage features pixi workspace feature add cuda pixi workspace feature list |
|
|
Manage workspace version pixi workspace version get pixi workspace version set 1.2.0 pixi workspace version major # bump major pixi workspace version minor # bump minor pixi workspace version patch # bump patch |
|
|
Export workspace pixi workspace export conda-explicit-spec pixi workspace export conda-environment |
|
|
Import a file into an environment pixi import environment.yml |
Information & Inspection
|
Show system and workspace info pixi info |
|
|
List installed packages pixi list pixi list -e dev # specific environment pixi list --json # output as JSON |
|
|
Show dependency tree pixi tree
pixi tree -e dev |
|
|
Search for a conda package pixi search numpy pixi search 'numpy>=1.24' pixi search -c conda-forge scipy |
Lockfile & Configuration
|
Update lockfile without installing pixi lock |
|
|
Use lockfile as-is (frozen) pixi install --frozen pixi run --frozen <task> |
|
|
Verify lockfile matches manifest pixi install --locked pixi run --locked <task> |
|
|
Manage pixi configuration pixi config set default-channels '["conda-forge"]' pixi config get default-channels pixi config list pixi config edit # open config in editor |
|
|
Authenticate to a channel pixi auth login prefix.dev --token <TOKEN> pixi auth login anaconda.org --username <USER> pixi auth logout prefix.dev |
Misc
|
Generate shell completions pixi completion --shell bash >> ~/.bashrc pixi completion --shell zsh >> ~/.zshrc pixi completion --shell fish >> ~/.config/fish/completions/pixi.fish |
|
|
Update pixi itself pixi self-update pixi self-update --version 0.30.0 # specific version |
|
|
Build a conda package pixi build |
|
|
Upload a conda package pixi upload prefix.dev <path-to-package> |
Notes
- Based on the Pixi documentation
- Pixi is a package manager for multi-language projects built on top of the conda ecosystem
- CheatSheet author: Ismail Hatim
