Skip to main content
The pixi import command imports dependencies from external environment files (conda environment.yml or requirements.txt) into your pixi workspace.

Usage

pixi import [OPTIONS] <FILE>

Arguments

FILE
string
required
Path to the environment file to import. Supported formats:
  • environment.yml or environment.yaml (conda environment file)
  • requirements.txt (PyPI requirements file)
If --format is not specified, pixi will try to detect the format automatically.

Options

Format Selection

--format
string
Explicitly specify the file format to interpret. Options:
  • conda-env - Conda environment file (environment.yml)
  • pypi-txt - PyPI requirements file (requirements.txt)
Case-insensitive.
pixi import environment.yml --format conda-env
pixi import requirements.txt --format pypi-txt

Platform Configuration

--platform
Platform
Specify platforms for the imported environment. Can be specified multiple times.Short flag: -p
pixi import environment.yml --platform linux-64 --platform osx-arm64

Environment and Feature Names

--environment
string
Name for the created environment.Short flag: -eIf not provided, attempts to use the name field from conda environment files. For PyPI files, this is required.
--feature
string
Name for the created feature.Short flag: -fIf not provided, uses the same value as --environment.
pixi import environment.yml --environment ml-env --feature ml
pixi import requirements.txt --environment test --feature testing

Import Formats

Conda Environment Files

When importing conda environment files, pixi extracts:
  • Dependencies (both conda and pip)
  • Channels
  • Environment name (if specified)
Example environment.yml:
name: myenv
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.11
  - numpy>=1.20
  - pip:
    - requests
    - flask
Import command:
pixi import environment.yml
Resulting pixi.toml:
[feature.myenv.dependencies]
python = "3.11.*"
numpy = ">=1.20"

[feature.myenv.pypi-dependencies]
requests = "*"
flask = "*"

[environments]
myenv = ["myenv"]

PyPI Requirements Files

Unnamed requirements (direct URLs without package names) are currently unsupported. Constraints in requirements files are ignored with a warning.
Example requirements.txt:
requests==2.28.0
flask>=2.0,<3.0
django
Import command:
pixi import requirements.txt --environment web
Resulting pixi.toml:
[feature.web.pypi-dependencies]
requests = "==2.28.0"
flask = ">=2.0,<3.0"
django = "*"

[environments]
web = ["web"]

Behavior

Automatic Format Detection

If --format is not specified, pixi tries each supported format in order:
  1. Conda environment format
  2. PyPI requirements format
If all formats fail, an error is returned:
pixi import unknown-file.txt
# Error: Tried all formats for input file, but none were successful.
#        Pass a `format` argument to see the specific error for that format.

Environment Creation

  • New environment: Creates a new environment with the specified name and feature
  • Existing environment: Adds the feature to the existing environment if not already present
  • Feature addition: If the environment exists but doesn’t include the feature, the feature is added to it

Platform Handling

If platforms are specified with --platform, they are added to the feature:
pixi import environment.yml --platform linux-64 --platform osx-64
This adds the platforms to the feature’s platform list.

Examples

Import Conda Environment

pixi import environment.yml
Uses the name field from environment.yml:
name: data-science
channels:
  - conda-forge
dependencies:
  - python=3.11
  - pandas
  - numpy

Import with Custom Names

pixi import environment.yml --environment ml --feature machine-learning
Creates an environment named “ml” with a feature named “machine-learning”.

Import PyPI Requirements

pixi import requirements.txt --environment backend --feature api
PyPI files require explicit --environment or --feature specification.

Import with Platforms

pixi import environment.yml --platform linux-64 --platform osx-arm64
Imports dependencies and configures them for specific platforms.

Import with Explicit Format

pixi import deps.txt --format pypi-txt --environment deps
Forces interpretation as a PyPI requirements file.

Import to Existing Environment

# First import
pixi import base.yml --environment prod

# Add more dependencies to the same environment
pixi import additional.yml --environment prod --feature extras
The feature “extras” is added to the existing “prod” environment.

Global Options

--manifest-path
string
Path to pixi.toml, pyproject.toml, or workspace directory.Short flag: -m
pixi import environment.yml --manifest-path /path/to/project

Config Options

These options override global configuration:
  • --tls-no-verify: Disable TLS verification
  • --auth-file <FILE>: Path to authentication file
  • --pypi-keyring-provider <PROVIDER>: Keyring provider for PyPI

Troubleshooting

Missing Environment Name

Error: Missing name: provide --feature or --environment, or set 'name:' in input file Solution: Specify the environment/feature name explicitly:
pixi import environment.yml --environment myenv
Or ensure the conda environment file has a name field.

Unsupported Format

Error: Tried all formats for input file, but none were successful Solution: Specify the format explicitly:
pixi import file.txt --format pypi-txt

Unnamed Requirements

Error: Error parsing input file: unnamed requirements are currently unsupported Solution: Ensure all requirements in requirements.txt have package names:
# ❌ Unsupported
https://github.com/user/repo/archive/main.zip

# ✅ Supported
mypackage @ https://github.com/user/repo/archive/main.zip

Constraints Ignored

Warning: Constraints detected in input file, but these are currently unsupported Constraints (lines starting with -c in requirements.txt) are not yet supported and will be ignored.

Limitations

Current limitations:
  • Unnamed requirements are not supported
  • Constraints files (-c constraints.txt) are ignored
  • Environment variables from conda files are not imported

See Also