Skip to main content
Learn the three types of package dependencies and their specific roles in the build process.

Overview

Package dependencies in Pixi are more granular than workspace dependencies. While workspace dependencies are simply packages available in environments, package dependencies distinguish between when and where they’re needed:
Think of it this way:
  • Build dependencies run on your machine during compilation
  • Host dependencies are compiled into your package
  • Run dependencies are needed when using your package

Build Dependencies

Build dependencies are tools needed to build the package, installed for the architecture of the build machine.

When to Use Build Dependencies

Use for tools that:
  • Run during compilation but aren’t compiled into the package
  • Generate code or resources
  • Are specific to your development machine

Common Examples

Important for pixi-build-cmake users:The pixi-build-cmake backend automatically provides cmake, ninja, and C++ compilers. You don’t need to specify them:

Cross-Compilation Example

Build dependencies enable cross-compilation:
Build vs Host Platform:
  • Build platform: Your machine (e.g., osx-arm64)
  • Host/target platform: Where the code runs (e.g., linux-aarch64)
The terminology comes from cross-compilation:For most builds, build = host = target.

Host Dependencies

Host dependencies are needed during build/link time and are specific to the target platform.

When to Use Host Dependencies

Use for:
  • Libraries you link against
  • Headers you include
  • Base interpreters (Python, R, Node.js)
  • Build backends for interpreted languages

Common Examples

Python Build Backends

Python build tools must go in host-dependencies due to technical limitations:
Technical Limitation:Tools like hatchling, pip, and uv must be host dependencies (not build dependencies) to ensure they use the correct Python prefix during the build process. We’re working to improve this.

Native Code Libraries

When building C++ or other native code:

Cross-Compilation Scenario

Compiling on Linux x86_64 for Linux ARM:

Run-Exports

Many conda packages define run-exports, which automatically add run dependencies:
Most conda-forge packages have run-exports defined. When you add them to host-dependencies, they’re automatically added to run-dependencies - no need to specify twice!

Run Dependencies

Run dependencies (also just called “dependencies”) are required when using the package.

When to Use Run Dependencies

Use for:
  • Libraries loaded at runtime
  • Executables called by your package
  • Resources needed during execution

Common Examples

Run Dependencies in Workspaces

Run dependencies are similar to workspace dependencies:
Both make the package available at runtime, but package run-dependencies are included when others depend on your package.

Path Dependencies

Depend on other packages in your workspace:
See the workspace guide for multi-package examples.

Complete Example

Here’s a C++ package with all three dependency types:
pixi.toml

Python Package Example

pixi.toml
numpy appears in both host-dependencies (for headers during compilation of extensions) and run-dependencies (for runtime imports). This is common for packages with both C and Python components.

Decision Guide

Use this flowchart to determine dependency type:

Quick Reference Table

Common Patterns

Understanding Run-Exports

Run-exports automatically propagate dependencies:
View a package’s run-exports:
Run-exports prevent version mismatches between build and runtime. If you build against zlib 1.2.13, run-exports ensure users get a compatible version.

Best Practices

Add only what’s strictly needed:
Don’t duplicate host and run dependencies if run-exports exist:
Use version constraints appropriately:
Comment why dependencies exist:

Next Steps

Build Backends

How backends use different dependency types

Build Variants

How variants affect dependencies

C++ Packages

Dependency types in C++ builds

Python Packages

Dependency types in Python builds

Troubleshooting

Ensure it’s in host-dependencies:
Add to build-dependencies:
Add to run-dependencies:
Verify dependency type:
  • Build deps use build platform
  • Host deps use target platform