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 Environments

Programmes change. Few things are as frustrating as coming back to a project after a long time and spending the first {hours, days} updating your code to work with a new version of your favourite data analysis library. The same holds for debugging errors that occur only because your coauthor uses a slightly different setup.

The solution is to have isolated environments on a per-project basis. Pixi environments allow you to do precisely this. This page describes them a little bit and explains their use.

The following commands can either be executed in a terminal or the Powershell (Windows).

Using the environment

Updating packages

Precise versions of packages are pinned down in the file pixi.lock, ensuring reproducibility. If you want to update a package, make sure that you are in the project root and run

$ pixi update

to update all packages, or run

$ pixi update [package]

to update a specific [package].

Installing additional packages

To list installed packages, type

$ pixi list

If you want to add a package to your environment, you can add the package to the [tool.pixi.dependencies] section in the pyproject.toml file. Alternatively, you can run

$ pixi add [package]

You will notice that the pixi section in the pyproject.toml file is then also updated with the added package.