Skip to main content
When adding packages to Pixi, you can use precise specifications to control which package versions and builds you install. This is especially important for packages with multiple builds for different hardware configurations.

Quick Examples

Conda Package Specifications

Pixi uses the conda MatchSpec format for specifying conda package requirements.

Basic Version Specifications

Simple version constraints:

Version Operators

Use ~= for compatible releases: ~=3.11.0 means >=3.11.0,<3.12.0.

Full MatchSpec Syntax

For precise control over package variants, use the full MatchSpec syntax:

Command Line Syntax

Equals syntax (compact):
Bracket syntax (explicit):
Both syntaxes are equivalent - use whichever is clearer for your use case.

TOML Mapping Syntax

In pixi.toml, use the mapping syntax for complete control:
Available fields:
  • version - Version constraint with operators
  • build - Build string pattern with wildcards
  • build-number - Build number constraint
  • channel - Channel name or URL
  • sha256/md5 - Package checksums
  • license - Expected license
  • file-name - Specific package file

Build Strings

Build strings identify specific builds of the same package version, especially for:
  • Hardware acceleration - CPU vs GPU/CUDA builds
  • Python versions - Different Python interpreter builds
  • Compiler variants - Different compiler versions
A build string typically looks like: py311h43a39b2_0
  • py311 - Python version indicator
  • h43a39b2 - Build configuration hash
  • _0 - Build number

Common Build Patterns

Build strings are platform-specific. A build like py311h43a39b2_0 might only exist for certain platforms.

Build Numbers

Build numbers increment when a package is rebuilt with the same version:
Use build numbers when:
  • A package was rebuilt to fix compilation issues
  • You need a specific rebuild with bug fixes
  • Creating reproducible environments requiring exact builds

Channels

Channels are repositories where conda packages are hosted:
Channels must be listed in workspace configuration:
Or add via CLI:

Package Checksums

Verify package integrity with checksums:
When specified, Pixi:
  • Verifies downloaded packages match the checksum
  • Fails installation if checksums don’t match
  • Ensures you get the exact package expected
Prefer SHA256 over MD5 for better security.

Source Packages

pixi-build is a preview feature and will change before stabilization.

Path-Based Sources

Git-Based Sources

Available git fields:
  • git - Repository URL
  • branch - Branch name
  • tag - Git tag
  • rev - Specific commit SHA
  • subdirectory - Path within repository

PyPI Package Specifications

Pixi supports PyPI packages using PEP 440 version specifiers.

Command Line Syntax

TOML Mapping Syntax

Real-World Examples

Machine Learning with CUDA

Multi-Python Version Testing

Mixing Conda and PyPI

Best Practices

Pin Critical Dependencies
Use Version Ranges for Libraries
Specify Builds for Hardware
Prefer Conda Over PyPI When Available
Document Package Sources

Further Reading