pixi add command adds dependencies to your workspace manifest and updates the lock file.
Usage
Arguments
The dependency to add. Can be:
- Package name:
numpy - Conda MatchSpec:
python=3.11.*,numpy>=1.20,<2.0 - PyPI requirement:
requests==2.28.0(with--pypi) - Version spec:
python=3.11,numpy>=1.20
Basic Options
PyPI Dependencies
Add as a PyPI dependency instead of conda. Conflicts with
--host and --build.Platform-Specific Dependencies
Platform for which the dependency should be added. Can be specified multiple times.Short flag:
-pFeature-Specific Dependencies
Feature to add the dependency to.Short flag:
-fEditable PyPI Packages
Install PyPI package in editable mode. Requires
--pypi.Dependency Type Options
These options are hidden by default but available for advanced use cases.
Add as a host dependency. Conflicts with
--build and --pypi.Add as a build dependency. Conflicts with
--host and --pypi.Git Dependencies
Git Repository
Git repository URL for the dependency.Short flag:
-gGit Reference
Git branch to use. Requires
--git.Git tag to use. Requires
--git.Git revision (commit SHA) to use. Requires
--git.Only one of
--branch, --tag, or --rev can be specified.Git Subdirectory
Subdirectory of the git repository. Requires
--git.Short flag: -sUpdate Options
Skip Installation
Don’t install the environment, only update the lock file.
Lock File Usage
Install as defined in the lock file without updating it.Env:
PIXI_FROZENCheck if lock file is up-to-date, abort if not.Env:
PIXI_LOCKEDExamples
Basic Package Addition
Add the latest version:pixi.toml:
Specific Version
pixi.toml:
Version Range
pixi.toml:
Multiple Packages
PyPI Packages
pixi.toml:
PyPI with Version
pyproject.toml (if using pyproject format):
Platform-Specific Package
pixi.toml:
Feature-Specific Packages
pixi.toml:
Git Repository
pixi.toml:
Git with Branch
pixi.toml:
Editable Local Package
pixi.toml:
Pinning Strategy
The pinning strategy determines how version constraints are added. Configure globally:~/.pixi/config.toml
Strategy Options
| Strategy | Example Input | Resulting Constraint |
|---|---|---|
no-pin | numpy | * |
semver | numpy=1.26.0 | >=1.26.0,<2 (or >=1.26.0,<1.27 for v0) |
exact-version | numpy=1.26.0 | ==1.26.0 |
major | numpy=1.26.0 | >=1.26.0,<2 |
minor | numpy=1.26.0 | >=1.26.0,<1.27 |
latest-up | numpy=1.26.0 | >=1.26.0 |
Non-SemVer Packages
These packages default to minor pinning:- Python
- Rust
- Julia
- GCC, GXX, GFortran
- NodeJS, Deno
- R, R-Base
- Perl
PyProject.toml Behavior
When usingpyproject.toml format:
Default Feature
project.dependencies:
Named Feature
dependency-groups:
Platform or Editable
With--platform or --editable, adds to pixi tables:
Combining Options
Platform + Feature
Multiple Platforms
PyPI + Feature
Global Options
Path to
pixi.toml, pyproject.toml, or workspace directory.Short flag: -mConfig Options
These options override global configuration:--pinning-strategy <STRATEGY>: Set pinning strategy--tls-no-verify: Disable TLS verification--auth-file <FILE>: Path to authentication file--pypi-keyring-provider <PROVIDER>: Keyring provider for PyPI
Troubleshooting
Package Not Found
Error:package 'numpyy' not found
Solution: Check package name spelling:
Version Conflict
Error:cannot satisfy version constraint
Solution: Relax version constraints or check compatibility:
Platform Not Supported
Error:package not available for platform
Solution: Check package availability or use different package:
PyPI and Conda Conflict
Error:cannot mix --pypi with --host or --build
Solution: Separate commands:
See Also
- pixi remove - Remove dependencies
- pixi install - Install dependencies
- pixi update - Update dependencies
- pixi upgrade - Upgrade dependencies