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

Arguments

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

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.

Platform Configuration

Platform
Specify platforms for the imported environment. Can be specified multiple times.Short flag: -p

Environment and Feature Names

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.
string
Name for the created feature.Short flag: -fIf not provided, uses the same value as --environment.

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:
Import command:
Resulting pixi.toml:

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:
Import command:
Resulting pixi.toml:

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:

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:
This adds the platforms to the feature’s platform list.

Examples

Import Conda Environment

Uses the name field from environment.yml:

Import with Custom Names

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

Import PyPI Requirements

PyPI files require explicit --environment or --feature specification.

Import with Platforms

Imports dependencies and configures them for specific platforms.

Import with Explicit Format

Forces interpretation as a PyPI requirements file.

Import to Existing Environment

The feature “extras” is added to the existing “prod” environment.

Global Options

string
Path to pixi.toml, pyproject.toml, or workspace directory.Short flag: -m

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

Unnamed Requirements

Error: Error parsing input file: unnamed requirements are currently unsupported Solution: Ensure all requirements in requirements.txt have package names:

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