TIL: Pixi by prefix.dev

I love micromamba, but pixi seems like the natural next step moving forward!
TIL
Author

Hampus Londögård

Published

March 20, 2024

This is a very short one. Keeping it for myself!

For my recent minor projects I’ve been utilizing Pixi to run my virtual environments and it actually works great!

It’s simple to start and keep going. What’s even better?

  1. Supports multiple environments (e.g. CUDA + CPU)
  2. Supports multiple platforms (e.g. osx-arm64 and linux-64)!
  3. Fast (3x faster than micromamba, 10x faster than conda!)
  4. Integrates better with pypi
  5. Has tasks (e.g. pixi run test or pixi run inference) that you define yourself
  6. Lockfiles, it’s painful to use micromambas lockfiles. Hence dual file system as in poetry/nodeJS etc is great!

Helpful right? Indeed!

Simple get-started

pixi init # create toml and lock files
pixi add python polars # add python and polars as dependencies

pixi shell # activates the virtual environment
# Alternatively, "pixi run python ..."

Add Task

Tasks are really awesome to reduce the threshold to enter projects. It’s simpler than a spread of bash-scripts or other things.

One standardized way to do things! :)

pixi task add gui "solara run app.py" # Adds task

pixi run gui # runs Solara App

Outro

Please read the docs to learn more!