pixi add#
About#
Adds dependencies to the workspace
Usage#
Arguments#
-
<SPEC>- The dependency as names, conda MatchSpecs or PyPi requirements
May be provided more than once.
required:true
Options#
-
--pypi- The specified dependencies are pypi dependencies. Conflicts with
hostandbuild
-
--platform (-p) <PLATFORM>- The platform for which the dependency should be modified
May be provided more than once.
-
--feature (-f) <FEATURE>- The feature for which the dependency should be modified
default:default
-
--editable- Whether the pypi requirement should be editable
Config Options#
-
--auth-file <AUTH_FILE>- Path to the file containing the authentication token
-
--concurrent-downloads <CONCURRENT_DOWNLOADS>- Max concurrent network requests, default is
50
-
--concurrent-solves <CONCURRENT_SOLVES>- Max concurrent solves, default is the number of CPUs
-
--pinning-strategy <PINNING_STRATEGY>- Set pinning strategy
options:semver,minor,major,latest-up,exact-version,no-pin
-
--pypi-keyring-provider <PYPI_KEYRING_PROVIDER>- Specifies whether to use the keyring to look up credentials for PyPI
options:disabled,subprocess
-
--run-post-link-scripts- Run post-link scripts (insecure)
-
--tls-no-verify- Do not verify the TLS certificate of the server
-
--use-environment-activation-cache- Use environment activation cache (experimental)
Git Options#
-
--git (-g) <GIT>- The git url to use when adding a git dependency
-
--branch <BRANCH>- The git branch
-
--tag <TAG>- The git tag
-
--rev <REV>- The git revision
-
--subdir (-s) <SUBDIR>- The subdirectory of the git repository to use
Update Options#
-
--no-install- Don't modify the environment, only modify the lock-file
-
--frozen- Install the environment as defined in the lockfile, doesn't update lockfile if it isn't up-to-date with the manifest file
env:PIXI_FROZEN
-
--locked- Check if lockfile is up-to-date before installing the environment, aborts when lockfile isn't up-to-date with the manifest file
env:PIXI_LOCKED
Global Options#
-
--manifest-path <MANIFEST_PATH>- The path to
pixi.toml,pyproject.toml, or the workspace directory
Description#
Adds dependencies to the workspace
The dependencies should be defined as MatchSpec for conda package, or a PyPI
requirement for the --pypi dependencies. If no specific version is
provided, the latest version compatible with your workspace will be chosen
automatically or a * will be used.
Example usage:
pixi add python=3.9: This will select the latest minor version that complies with 3.9.*, i.e., python version 3.9.0, 3.9.1, 3.9.2, etc.pixi add python: In absence of a specified version, the latest version will be chosen. For instance, this could resolve to python version 3.11.3.* at the time of writing.
Adding multiple dependencies at once is also supported:
pixi add python pytest: This will add bothpythonandpytestto the workspace's dependencies.
The --platform and --build/--host flags make the dependency target
specific.
pixi add python --platform linux-64 --platform osx-arm64: Will add the latest version of python for linux-64 and osx-arm64 platforms.pixi add python --build: Will add the latest version of python for as a build dependency.
Mixing --platform and --build/--host flags is supported
The --pypi option will add the package as a pypi dependency. This cannot
be mixed with the conda dependencies
pixi add --pypi boto3pixi add --pypi "boto3==version"
If the workspace manifest is a pyproject.toml, adding a pypi dependency will
add it to the native pyproject project.dependencies array or to the native
dependency-groups table if a feature is specified:
pixi add --pypi boto3will addboto3to theproject.dependenciesarraypixi add --pypi boto3 --feature awswill addboto3to thedependency-groups.awsarraypixi add --pypi --editable 'boto3 @ file://absolute/path/to/boto3'will add the local editableboto3to thepypi-dependenciesarray
Note that if --platform or --editable are specified, the pypi dependency
will be added to the tool.pixi.pypi-dependencies table instead as native
arrays have no support for platform-specific or editable dependencies.
These dependencies will then be read by pixi as if they had been added to
the pixi pypi-dependencies tables of the default or of a named feature.
The versions will be automatically added with a pinning strategy based on semver or the pinning strategy set in the config. There is a list of packages that are not following the semver versioning scheme but will use the minor version by default: Python, Rust, Julia, GCC, GXX, GFortran, NodeJS, Deno, R, R-Base, Perl
Examples#
pixi add numpy # (1)!
pixi add numpy pandas "pytorch>=1.8" # (2)!
pixi add "numpy>=1.22,<1.24" # (3)!
pixi add --manifest-path ~/myworkspace/pixi.toml numpy # (4)!
pixi add --host "python>=3.9.0" # (5)!
pixi add --build cmake # (6)!
pixi add --platform osx-64 clang # (7)!
pixi add --no-install numpy # (8)!
pixi add --no-lockfile-update numpy # (9)!
pixi add --feature featurex numpy # (10)!
pixi add --git https://github.com/wolfv/pixi-build-examples boost-check # (11)!
pixi add --git https://github.com/wolfv/pixi-build-examples --branch main --subdir boost-check boost-check # (12)!
pixi add --git https://github.com/wolfv/pixi-build-examples --tag v0.1.0 boost-check # (13)!
pixi add --git https://github.com/wolfv/pixi-build-examples --rev e50d4a1 boost-check # (14)!
# Add a pypi dependency
pixi add --pypi requests[security] # (15)!
pixi add --pypi Django==5.1rc1 # (16)!
pixi add --pypi "boltons>=24.0.0" --feature lint # (17)!
pixi add --pypi "boltons @ https://files.pythonhosted.org/packages/46/35/e50d4a115f93e2a3fbf52438435bb2efcf14c11d4fcd6bdcd77a6fc399c9/boltons-24.0.0-py3-none-any.whl" # (18)!
pixi add --pypi "exchangelib @ git+https://github.com/ecederstrand/exchangelib" # (19)!
pixi add --pypi "project @ file:///absolute/path/to/project" # (20)!
pixi add --pypi "project@file:///absolute/path/to/project" --editable # (21)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --pypi # (22)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --branch main --pypi # (23)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --rev e50d4a1 --pypi # (24)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --tag v0.1.0 --pypi # (25)!
pixi add --git https://github.com/mahmoud/boltons.git boltons --tag v0.1.0 --pypi --subdir boltons # (26)!
- This will add the
numpypackage to the project with the latest available for the solved environment. - This will add multiple packages to the project solving them all together.
- This will add the
numpypackage with the version constraint. - This will add the
numpypackage to the project of the manifest file at the given path. - This will add the
pythonpackage as a host dependency. There is currently no different behavior for host dependencies. - This will add the
cmakepackage as a build dependency. There is currently no different behavior for build dependencies. - This will add the
clangpackage only for theosx-64platform. - This will add the
numpypackage to the manifest and lockfile, without installing it in an environment. - This will add the
numpypackage to the manifest without updating the lockfile or installing it in the environment. - This will add the
numpypackage in the featurefeaturex. - This will add the
boost-checksource package to the dependencies from the git repository. - This will add the
boost-checksource package to the dependencies from the git repository usingmainbranch and theboost-checkfolder in the repository. - This will add the
boost-checksource package to the dependencies from the git repository usingv0.1.0tag. - This will add the
boost-checksource package to the dependencies from the git repository usinge50d4a1revision. - This will add the
requestspackage aspypidependency with thesecurityextra. - This will add the
pre-releaseversion ofDjangoto the project as apypidependency. - This will add the
boltonspackage in the featurelintaspypidependency. - This will add the
boltonspackage with the givenurlaspypidependency. - This will add the
exchangelibpackage with the givengiturl aspypidependency. - This will add the
projectpackage with the givenfileurl aspypidependency. - This will add the
projectpackage with the givenfileurl as aneditablepackage aspypidependency. - This will add the
boltonspackage with the givengiturl aspypidependency. - This will add the
boltonspackage with the givengiturl andmainbranch aspypidependency. - This will add the
boltonspackage with the givengiturl ande50d4a1revision aspypidependency. - This will add the
boltonspackage with the givengiturl andv0.1.0tag aspypidependency. - This will add the
boltonspackage with the givengiturl,v0.1.0tag and theboltonsfolder in the repository aspypidependency.
Tip
If you want to use a non default pinning strategy, you can set it using pixi's configuration.
The default issemver which will pin the dependencies to the latest major version or minor for v0 versions.
Note
There is an exception to this rule when you add a package we defined as non semver, then we'll use the minor strategy.
These are the packages we defined as non semver:
Python, Rust, Julia, GCC, GXX, GFortran, NodeJS, Deno, R, R-Base, Perl