Skip to content

Pixi#

Pixi with magic wand

Pixi is a package management tool for developers.

  • ๐Ÿงช Conda: Leverage the existing conda ecosystem to obtain packages written in Python, C, C++, and many other languages.
  • ๐Ÿ”„ Reproducibility: Work in dedicated, isolated environments that can be easily recreated.
  • ๐Ÿ› ๏ธ Tasks: Manage complex pipelines effortlessly.
  • ๐ŸŒ Multi Platform: Ensure compatibility across Linux, macOS, Windows, and more.
  • ๐Ÿงฉ Multi Environment: Compose multiple environments within a single Pixi manifest.
  • ๐Ÿ—๏ธ Building: Build packages from source using powerful build backends.
  • ๐Ÿ“ฆ Distributing: Distribute your software via conda channels or various other options.
  • ๐Ÿ Python: Full support for pyproject.toml and PyPI dependencies.
  • ๐ŸŒ Global Tools: Install globally available tools, safely stored in separate environments.

Installation#

To install pixi you can run the following command in your terminal:

curl -fsSL https://pixi.sh/install.sh | bash

The above invocation will automatically download the latest version of pixi, extract it, and move the pixi binary to ~/.pixi/bin. The script will also extend the PATH environment variable in the startup script of your shell to include ~/.pixi/bin. This allows you to invoke pixi from anywhere.

powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"

The above invocation will automatically download the latest version of pixi, extract it, and move the pixi binary to LocalAppData/pixi/bin. The command will also add LocalAppData/pixi/bin to your PATH environment variable, allowing you to invoke pixi from anywhere.

Tip

You might need to restart your terminal or source your shell for the changes to take effect.

Check out our installation docs to learn about alternative installation methods, autocompletion and more.

Getting Started#

Initialize a new workspace and navigate to the workspace directory.

pixi init hello-world
cd hello-world

This will create a Pixi manifest which is a file called pixi.toml. It describes the structure, dependencies and metadata of your workspace.

pixi.toml
[workspace]
channels = ["conda-forge"]
name = "hello-world"
platforms = ["linux-64", "osx-arm64", "win-64"]

Let's add dependencies!

pixi add cowpy python

The dependencies are not only installed, but also tracked in the manifest.

pixi.toml
[workspace]
channels = ["conda-forge"]
name = "hello-world"
platforms = ["linux-64", "osx-arm64", "win-64"]

[dependencies]
cowpy = "1.1.*"
python = "3.13.*"

We can now create a Python script which uses the cowpy library.

hello.py
from cowpy.cow import Cowacter

message = Cowacter().milk("Hello Pixi fans!")
print(message)

The dependencies are installed in a Pixi environment. In order to run a command within an environment, we prefix it with pixi run.

pixi run python hello.py
 __________________
< Hello Pixi fans! >
 ------------------
     \   ^__^
      \  (oo)\_______
         (__)\       )\/\
           ||----w |
           ||     ||

You can also put this run command in a task.

pixi task add hello python hello.py
pixi.toml
[workspace]
channels = ["conda-forge"]
name = "hello-world"
platforms = ["linux-64", "osx-arm64", "win-64"]

[tasks]
start = "python hello.py"

[dependencies]
cowpy = "1.1.*"
python = "3.13.*"

After adding the task, you can run the task using its name.

pixi run start
 __________________
< Hello Pixi fans! >
 ------------------
     \   ^__^
      \  (oo)\_______
         (__)\       )\/\
           ||----w |
           ||     ||

You now know how to add dependencies and tasks to your environment. Put the workspace folder on a different machine, and you will find that Pixi will be able to fully reproduce your setup.

If you want to learn more about Pixi, check out the next page!