| name | pixi-package-manager |
| description | This skill should be used when the user asks to "set up pixi", "add pixi dependencies", "create pixi environment", "migrate from conda to pixi", "configure pixi.toml", "add pixi tasks", "set up reproducible environment", "manage conda-forge packages", "create multi-environment project", or needs guidance on pixi package manager, conda-forge integration, PyPI dependencies in pixi, pixi task automation, or replacing conda/mamba workflows with pixi. |
Pixi Package Manager for Scientific Python
Master pixi, the modern package manager that unifies conda and PyPI ecosystems for fast, reproducible scientific Python development. Learn how to manage complex scientific dependencies, create isolated environments, and build reproducible workflows using pyproject.toml integration.
Official Documentation: https://pixi.sh
GitHub: https://github.com/prefix-dev/pixi
Quick Reference Card
Installation & Setup
curl -fsSL https://pixi.sh/install.sh | bash
iwr -useb https://pixi.sh/install.ps1 | iex
pixi init --format pyproject
pixi init --format pyproject --import-environment
Essential Commands
pixi add numpy scipy pandas
pixi add --pypi pytest-cov
pixi add --feature dev pytest ruff
pixi install
pixi run python script.py
pixi run pytest
pixi shell
pixi task add test "pytest tests/"
pixi task add docs "sphinx-build docs/ docs/_build"
pixi run test
pixi run docs
pixi update numpy
pixi update
pixi list
pixi tree numpy
Quick Decision Tree: Pixi vs UV vs Both
Need compiled scientific libraries (NumPy, SciPy, GDAL)?
├─ YES → Use pixi (conda-forge has pre-built binaries)
└─ NO → Consider uv for pure Python projects
Need multi-language support (Python + R, Julia, C++)?
├─ YES → Use pixi (supports conda ecosystem)
└─ NO → uv sufficient for Python-only
Need multiple environments (dev, test, prod, GPU, CPU)?
├─ YES → Use pixi features for environment management
└─ NO → Single environment projects work with either
Need reproducible environments across platforms?
├─ CRITICAL → Use pixi (lockfiles include all platforms)
└─ LESS CRITICAL → uv also provides lockfiles
Want to use both conda-forge AND PyPI packages?
├─ YES → Use pixi (seamless integration)
└─ ONLY PYPI → uv is simpler and faster
Legacy conda environment files (environment.yml)?
├─ YES → pixi can import and modernize
└─ NO → Start fresh with pixi or uv
When to Use This Skill
- Setting up scientific Python projects with complex compiled dependencies (NumPy, SciPy, Pandas, scikit-learn, GDAL, netCDF4)
- Building reproducible research environments that work identically across different machines and platforms
- Managing multi-language projects that combine Python with R, Julia, C++, or Fortran
- Creating multiple environment configurations for different hardware (GPU/CPU), testing scenarios, or deployment targets
- Replacing conda/mamba workflows with faster, more reliable dependency resolution
- Developing packages that depend on both conda-forge and PyPI packages
- Migrating from environment.yml or requirements.txt to modern, reproducible workflows
- Running automated scientific workflows with task runners and CI/CD integration
- Working with geospatial, climate, or astronomy packages that require complex C/Fortran dependencies
Core Concepts
1. Unified Package Management (conda + PyPI)
Pixi resolves dependencies from both conda-forge and PyPI in a single unified graph, ensuring compatibility:
[project]
name = "my-science-project"
dependencies = [
"numpy>=1.24",
"pandas>=2.0",
]
[tool.pixi.pypi-dependencies]
my-custom-pkg = ">=1.0"
Why this matters for scientific Python:
- Get optimized NumPy/SciPy builds from conda-forge (MKL, OpenBLAS)
- Use PyPI packages not available in conda
- Single lockfile ensures all dependencies are compatible
2. Multi-Platform Lockfiles
Pixi generates pixi.lock with dependency specifications for all platforms (Linux, macOS, Windows, different architectures):
Benefits:
- Commit lockfile to git → everyone gets identical environments
- Works on collaborator's different OS without changes
- CI/CD uses exact same versions as local development
3. Feature-Based Environments
Create multiple environments using features without duplicating dependencies:
[tool.pixi.feature.test.dependencies]
pytest = ">=7.0"
pytest-cov = ">=4.0"
[tool.pixi.feature.gpu.dependencies]
pytorch-cuda = "11.8.*"
[tool.pixi.environments]
test = ["test"]
gpu = ["gpu"]
gpu-test = ["gpu", "test"]
4. Task Automation
Define reusable commands as tasks:
[tool.pixi.tasks]
test = "pytest tests/ -v"
format = "ruff format src/ tests/"
lint = "ruff check src/ tests/"
docs = "sphinx-build docs/ docs/_build"
analyse = { cmd = "python scripts/analyze.py", depends-on = ["test"] }
5. Fast Dependency Resolution
Pixi uses rattler (Rust-based conda resolver) for 10-100x faster resolution than conda:
- Parallel package downloads
- Efficient caching
- Smart dependency solver
6. pyproject.toml Integration
Pixi reads standard Python project metadata from pyproject.toml, enabling:
- Single source of truth for project configuration
- Compatibility with pip, uv, and other tools
- Standard Python packaging workflows
Quick Start
Minimal Example: Data Analysis Project
mkdir climate-analysis && cd climate-analysis
pixi init --format pyproject
pixi add python=3.11 numpy pandas matplotlib xarray
pixi add --feature dev pytest ipython ruff
cat > analyze.py << 'EOF'
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv("data.csv")
data.plot()
plt.savefig("output.png")
EOF
pixi run python analyze.py
pixi shell
python analyze.py
Patterns
See references/PATTERNS.md for detailed patterns including:
- Converting existing projects to Pixi
- Multi-environment scientific workflows
- Scientific library development
- Conda + PyPI dependency strategy
- Reproducible research environments
- Task dependencies and workflows
File Templates
Ready-to-use templates are available in the assets/ directory:
Common Issues and Solutions
See references/COMMON_ISSUES.md for solutions to:
- Package not found in conda-forge
- Conflicting dependencies
- Slow environment creation
- Platform-specific failures
- PyPI package installation fails
- Lockfile merge conflicts
- Editable install of local package
Best Practices Checklist
Project Setup
Dependency Management
Reproducibility
Performance
Development Workflow
Resources
Official Documentation
Community & Support
Related Technologies
Complementary Skills
- scientific-python-packaging: Modern Python packaging patterns
- scientific-python-testing: Testing strategies with pytest
- uv-package-manager: Fast pure-Python package management
Summary
Pixi revolutionizes scientific Python development by unifying conda and PyPI ecosystems with blazing-fast dependency resolution, reproducible multi-platform lockfiles, and seamless environment management. By leveraging pyproject.toml integration, pixi provides a modern, standards-compliant approach to managing complex scientific dependencies while maintaining compatibility with the broader Python ecosystem.
Key advantages for scientific computing:
- Optimized Scientific Packages: Access conda-forge's pre-built binaries for NumPy, SciPy, and other compiled packages with MKL/OpenBLAS optimizations
- Complex Dependencies Made Simple: Handle challenging packages like GDAL, netCDF4, and HDF5 that require C/Fortran/C++ system libraries
- True Reproducibility: Multi-platform lockfiles ensure identical environments across Linux, macOS, and Windows
- Flexible Environment Management: Feature-based environments for dev/test/prod, GPU/CPU, or any custom configuration
- Fast and Reliable: 10-100x faster than conda with Rust-based parallel dependency resolution
- Task Automation: Built-in task runner for scientific workflows, testing, and documentation
- Best of Both Worlds: Seamlessly mix conda-forge optimized packages with PyPI's vast ecosystem
Whether you're conducting reproducible research, developing scientific software, or managing complex data analysis pipelines, pixi provides the robust foundation for modern scientific Python development. By replacing conda/mamba with pixi, you gain speed, reliability, and modern workflows while maintaining full access to the scientific Python ecosystem.
Ready to get started? Install pixi, initialize your project with pixi init --format pyproject, and experience the future of scientific Python package management.