Adding a New Pixi Environment

As an example of adding a new Pixi environment to and existing workspace, we’ll add an environment for running Parcels

The installation instructions that Parcels provides include the instruction to create a Conda environment with:

 $ conda create -n parcels -c conda-forge parcels trajan cartopy jupyter

The equivalent Pixi commands are:

$ pixi add --feature parcels parcels trajan cartopy jupyter
$ pixi workspace environment add parcels --feature parcels --no-default-feature
$ pixi install -e parcels

The first command adds a Pixi Feature named parcels that has 4 packages, parcels, trajan, cartopy, and jupyter as dependencies. This command updates the pixi.toml manifest file.

The second command adds a Pixi Environment named parcels that includes the parcels feature. The --no-default-feature option isolates the parcels environment from other environments in the workspace. This command also updates the pixi.toml manifest file.

The third command downloads the dependency packages (if necessary) and installs them in the parcels environment. This command updates the pixi.lock lock file.

Commit and push the changes in the pixi.toml and pixi.lock files.

To run a command in the parcels environment, use the -e parcels or --environment parcels option in the pixi run command. Example:

$ pixi run -e parcels python example_peninsula.py --fieldset 100 100