pixi add command adds dependencies to your workspace manifest and updates the lock file.
Usage
Arguments
string
required
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
boolean
default:"false"
Add as a PyPI dependency instead of conda. Conflicts with
--host and --build.Platform-Specific Dependencies
string
Platform for which the dependency should be added. Can be specified multiple times.Short flag:
-pFeature-Specific Dependencies
string
default:"default"
Feature to add the dependency to.Short flag:
-fEditable PyPI Packages
boolean
default:"false"
Install PyPI package in editable mode. Requires
--pypi.Dependency Type Options
These options are hidden by default but available for advanced use cases.
boolean
default:"false"
Add as a host dependency. Conflicts with
--build and --pypi.boolean
default:"false"
Add as a build dependency. Conflicts with
--host and --pypi.Git Dependencies
Git Repository
string
Git repository URL for the dependency.Short flag:
-gGit Reference
string
Git branch to use. Requires
--git.string
Git tag to use. Requires
--git.string
Git revision (commit SHA) to use. Requires
--git.Only one of
--branch, --tag, or --rev can be specified.Git Subdirectory
string
Subdirectory of the git repository. Requires
--git.Short flag: -sUpdate Options
Skip Installation
boolean
default:"false"
Don’t install the environment, only update the lock file.
Lock File Usage
boolean
default:"false"
Install as defined in the lock file without updating it.Env:
PIXI_FROZENboolean
default:"false"
Check 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
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
string
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