Pixi
Pixi is a cross-platform (Windows, Mac, and Linux) and multi-language (Python, R, C/C++, Rust, Ruby, and many other languages) package manager and workflow tool built on the foundation of the Conda ecosystem. It provides developers with an exceptional experience similar to popular package managers like Cargo or Yarn. For more information see Pixi documentation
How to Install Pixi?
You can use the SStack tool to install Conda to manage software on discovery.
For example, to install Pixi stack named 2024A
in your home directory, run command:
sstack install -t pixi -n 2024A
This creates a module file that you can load in your environment to be able to use the stack to manage software, as shown in the following:
module use "/fs1/home/tahat/sstack/rhel_8/modules"
module load pixi/2024A
To check if pixi
is loaded and what version is it, run the following command:
pixi --version
Output
pixi 0.27.1
How to Use Pixi to Manage Software?
You can use pixi
to create a project and install its dependencies. For example, initialize a new project in your current working directory and navigate to the project directory:
pixi init my-pixi-project
cd my-pixi-project
The init
command creates a folder named my-pixi-project
with the project configuration file pixi.toml
, also known as the project manifest.
Then, add the your dependencies to your project:
pixi add python
To install python in the project environment, run:
pixi install
When installing environments on old versions of Linux. You may encounter the following error:
× The current system has a mismatching virtual package. The project requires '__linux' to be at least version '5.10' but the system has version '4.18.0'
To fix this, edit the pixi.toml
file and add the following to lower their system requirements for the project:
[system-requirements]
linux = "4.12.14"
Inside the project, Create a python script named my_project.py
and add the following code:
print("Hello from my first pixi project!.")
To run the script, run the following command inside the project:
pixi run python hello_world.py
You can also run the script in a new shell, run:
pixi shell
Then, run the Python script:
python my_project.py
Pixi allows you to put this run command in a task.
pixi task add hello python my_project.py
Then, run the task using the following command:
pixi run hello
Global Installation
You can use Pixi as a global installation tool. When installing a package globally, it is available system-wide and isn’t tied to a specific project. To install a package globally, run:
pixi install global <package-name>
This command installs the package into its own environment and adds its binary to PATH, allowing you to access it anywhere on your system without activating the environment.