Backwards compatibility with conda

Last updated on 2025-06-15 | Edit this page

Estimated time: 15 minutes

Overview

Questions

  • Can Pixi environments be backported to conda formats?

Objectives

  • Learn how to export Pixi workspace environments as conda environment definition files
  • Learn how to export Pixi workspace environments as conda explicit spec files

Backporting to conda environments


While Pixi is currently unique in its abilities, there may be situations in which given technical debt, migration effort in large collaborations, or collaborator preferences that switching all infrastructure to use Pixi might not yet be feasible. It would still be useful to take advantage of Pixi’s technology and features as an individual but be able to export Pixi workspace environments and lock files to the “legacy system” of conda. 1 Luckily, we can do this with the pixi workspace export commands.

Exporting workspace environments to conda environment definition files


If you want to export a Pixi workspace environment’s high level dependencies to a conda environment definition file (environment.yaml) you can use the pixi workspace export conda-environment subcommand

BASH

pixi workspace export conda-environment --environment <environment> --platform <platform> environment.yaml

where if no environment or platform options are given the default environment and the system’s platform will be used.

Export one of your Pixi workspace environments to a conda environment

BASH

pixi workspace export conda-environment environment.yaml

YAML

name: default
channels:
- conda-forge
- nodefaults
dependencies:
- python >=3.13.5,<3.14
- numpy >=2.3.0,<3
- notebook >=7.4.3,<8
- jupyterlab >=4.4.3,<5

Exporting workspace environments to conda explicit spec files


We’d like to ideally go further than the high level conda environment definition file and aim for computational reproducibility with a conda explicit spec file. Conda explicit spec files are a form of platform specific lock files that consist of a text file with an @EXPLICIT header followed by a list of conda package URLs, optionally followed by their MD5 or SHA256 digest (aka, “hash”).

Example:

TXT

@EXPLICIT
https://conda.anaconda.org/conda-forge/noarch/python_abi-3.13-7_cp313.conda#e84b44e6300f1703cb25d29120c5b1d8

Explicit spec files can be created from locked Pixi workspace environments with the pixi workspace export conda-explicit-spec subcommand

BASH

pixi workspace export conda-explicit-spec --environment <environment> --platform <platform> .

where if no environment or platform options are given the default environment and the system’s platform will be used. The explicit spec file will be automatically named with the form <environment>_<platform>_conda_spec.txt. So if you are on a linux-64 machine and didn’t specify an environment name, your generated explicit spec file will be named default_linux-64_conda_spec.txt.

Caution

Conda spec files only support conda packages and do not support Python packages or source packages.

Export one of your Pixi workspace environment lock files as a conda explicit spec file

Hint: Check the --help output.

BASH

pixi workspace export conda-explicit-spec --platform linux-64 --platform osx-arm64 .

BASH

head -n 20 default_linux-64_conda_spec.txt

OUTPUT

# Generated by `pixi workspace export`
# platform: linux-64
@EXPLICIT
https://conda.anaconda.org/conda-forge/noarch/python_abi-3.13-7_cp313.conda#e84b44e6300f1703cb25d29120c5b1d8
https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda#4222072737ccff51314b5ece9c7d6f5a
https://conda.anaconda.org/conda-forge/linux-64/libgomp-15.1.0-h767d61c_2.conda#fbe7d535ff9d3a168c148e07358cd5b1
https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81
https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-2_gnu.tar.bz2#73aaf86a425cc6e73fcf236a5a46396d
https://conda.anaconda.org/conda-forge/linux-64/libgcc-15.1.0-h767d61c_2.conda#ea8ac52380885ed41c1baa8f1d6d2b93
https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.3.1-hb9d3cd8_2.conda#edb0dca6bc32e4f4789199455a1dbeb8
https://conda.anaconda.org/conda-forge/linux-64/tk-8.6.13-noxft_hd72426e_102.conda#a0116df4f4ed05c303811a837d5b39d8
https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-h2d0b736_3.conda#47e340acb35de30501a76c7c799c41d7
https://conda.anaconda.org/conda-forge/linux-64/readline-8.2-h8c095d6_2.conda#283b96675859b20a825f8fa30f311446
https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.4.26-hbd8a1cb_0.conda#95db94f75ba080a22eb623590993167b
https://conda.anaconda.org/conda-forge/linux-64/openssl-3.5.0-h7b32b05_1.conda#de356753cfdbffcde5bb1e86e3aa6cd0
https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-15.1.0-h69a702a_2.conda#ddca86c7040dd0e73b2b69bd7833d225
https://conda.anaconda.org/conda-forge/linux-64/libuuid-2.38.1-h0b41bf4_0.conda#40b61aab5c7ba9ff276c41cfffe6b80b
https://conda.anaconda.org/conda-forge/linux-64/libsqlite-3.50.0-hee588c1_0.conda#71888e92098d0f8c41b09a671ad289bc
https://conda.anaconda.org/conda-forge/linux-64/libmpdec-4.0.0-hb9d3cd8_0.conda#c7e925f37e3b40d893459e625f6a53f1
https://conda.anaconda.org/conda-forge/linux-64/liblzma-5.8.1-hb9d3cd8_1.conda#a76fd702c93cd2dfd89eff30a5fd45a8

BASH

head -n 20 default_osx-arm64_conda_spec.txt

OUTPUT

# Generated by `pixi workspace export`
# platform: osx-arm64
@EXPLICIT
https://conda.anaconda.org/conda-forge/noarch/python_abi-3.13-7_cp313.conda#e84b44e6300f1703cb25d29120c5b1d8
https://conda.anaconda.org/conda-forge/noarch/tzdata-2025b-h78e105d_0.conda#4222072737ccff51314b5ece9c7d6f5a
https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.1-h8359307_2.conda#369964e85dc26bfe78f41399b366c435
https://conda.anaconda.org/conda-forge/osx-arm64/tk-8.6.13-h892fb3f_2.conda#7362396c170252e7b7b0c8fb37fe9c78
https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h5e97a16_3.conda#068d497125e4bf8a66bf707254fff5ae
https://conda.anaconda.org/conda-forge/osx-arm64/readline-8.2-h1d1bf99_2.conda#63ef3f6e6d6d5c589e64f11263dc5676
https://conda.anaconda.org/conda-forge/noarch/ca-certificates-2025.4.26-hbd8a1cb_0.conda#95db94f75ba080a22eb623590993167b
https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.5.0-h81ee809_1.conda#5c7aef00ef60738a14e0e612cfc5bcde
https://conda.anaconda.org/conda-forge/osx-arm64/libsqlite-3.50.0-h3f77e49_0.conda#cda0ec640bc4698d0813a8fb459aee58
https://conda.anaconda.org/conda-forge/osx-arm64/libmpdec-4.0.0-h5505292_0.conda#85ccccb47823dd9f7a99d2c7f530342f
https://conda.anaconda.org/conda-forge/osx-arm64/liblzma-5.8.1-h39f12f2_1.conda#4e8ef3d79c97c9021b34d682c24c2044
https://conda.anaconda.org/conda-forge/osx-arm64/libffi-3.4.6-h1da3d7d_1.conda#c215a60c2935b517dcda8cad4705734d
https://conda.anaconda.org/conda-forge/osx-arm64/libexpat-2.7.0-h286801f_0.conda#6934bbb74380e045741eb8637641a65b
https://conda.anaconda.org/conda-forge/osx-arm64/bzip2-1.0.8-h99b78c6_7.conda#fc6948412dbbbe9a4c9ddbbcfe0a79ab
https://conda.anaconda.org/conda-forge/osx-arm64/python-3.13.3-h81fe080_101_cp313.conda#b3240ae8c42a3230e0b7f831e1c72e9f
https://conda.anaconda.org/conda-forge/osx-arm64/llvm-openmp-20.1.6-hdb05f8b_0.conda#7a3b28d59940a28e761e0a623241a832
https://conda.anaconda.org/conda-forge/osx-arm64/libgfortran5-14.2.0-h2c44a93_105.conda#06f35a3b1479ec55036e1c9872f97f2c

Caution

While conda spec files meet our criteria for computational reproducibility, they are essentially package list snapshots and lack the metadata to provide robust dependency graph inspection and targeted updates. They can be a useful tool, but are not robust lock file formats like those from Pixi and conda-lock.

Creating conda environments from the exports


To create a conda environment from the exported environment.yaml conda environment definition file, you use the normal conda environment creation command

BASH

conda env create --file environment.yaml

but to create a conda environment from the exported conda explicit spec file, use the command

BASH

conda create --name <name> --file <spec file>

or to install the packages given in the explicit spec file into an existing conda environment, use

BASH

conda install --name <name> --file <spec file>

So by using Pixi, you can fully export your workspace environments to conda environments and then use them, even to get the exact hash level locked environment from your Pixi workspace installed on another machine!

Caution

Conda does not check that the platform is correct for the machine or the dependencies given when installing from an explicit spec file. Only use spec files when you are certain that you have the same platform machine as the machine that created the spec file.

Key Points

  • If you need to use conda, you can export Pixi workspace environment to formats conda can use.
  • Exporting conda explicit spec files from Pixi locked environments provides the ability to create the same hash level locked environment with conda that Pixi solved.

  1. Conda is still a very well supported tool and the dominant conda package environment manager by numbers of users.↩︎