Skip to main content
The 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
Multiple packages can be specified.

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: -p

Feature-Specific Dependencies

string
default:"default"
Feature to add the dependency to.Short flag: -f

Editable 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: -g

Git 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: -s

Update 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_FROZEN
boolean
default:"false"
Check if lock file is up-to-date, abort if not.Env: PIXI_LOCKED

Examples

Basic Package Addition

Add the latest version:
Resulting pixi.toml:

Specific Version

Resulting pixi.toml:

Version Range

Resulting pixi.toml:

Multiple Packages

PyPI Packages

Resulting pixi.toml:

PyPI with Version

Resulting pyproject.toml (if using pyproject format):

Platform-Specific Package

Resulting pixi.toml:

Feature-Specific Packages

Resulting pixi.toml:

Git Repository

Resulting pixi.toml:

Git with Branch

Resulting pixi.toml:

Editable Local Package

Resulting pixi.toml:

Pinning Strategy

The pinning strategy determines how version constraints are added. Configure globally:
~/.pixi/config.toml
Or via CLI:

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 using pyproject.toml format:

Default Feature

Adds to native project.dependencies:

Named Feature

Adds to 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: -m

Config 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