conda-lockfiles#
conda-lockfiles provides support in conda for many types of lockfiles in the conda ecosystem.
Warning
This project is still in early stages of development. Don’t use it in production (yet). We do welcome feedback on what the expected behaviour should have been if something doesn’t work!
Please submit bug reports or feature requests here.
What is this?#
conda-lockfiles adds support for additional lockfile formats to conda. It supports different types of lockfiles from the ecosystem like conda-lock or pixi.
The basic usage is:
# Create environment from lockfile
conda env create -n ENV-NAME --env-spec=FORMAT --file=/path/to/lockfile
# Export current environment to lockfile
conda export -n ENV-NAME --format=FORMAT --file=/path/to/lockfile
Use --format with conda export (output format) and --env-spec with conda env create when you must name the input format; --env-spec is optional if conda recognizes the filename.
Currently supported lockfile formats:
conda-lock.yml (
conda-lock-v1)pixi.lock (
rattler-lock-v6orpixi-lock-v6)
Installation#
This is a conda plugin and must be installed in the base environment:
conda install -n base conda-forge::conda-lockfiles
Usage#
Creating a lockfile for the current environment#
conda export --format=FORMAT --file=FILE
To specify additional platforms:
conda export --format=FORMAT --file=FILE [--override-platforms] --platform=PLATFORM ...
See conda export docs for more details.
Creating a new environment from a lockfile#
conda env create --file=FILE
If conda is unable to determine the file format:
conda env create --file=FILE --env-spec=FORMAT
See conda env create docs for more details.
Examples#
Export one conda-lock file with several platforms (adjust platforms to what you need; exporting a platform different than the host may fail):
conda export \
--name myenv \
--format conda-lock-v1 \
--file conda-lock.yml \
--platform linux-64 \
--platform osx-64
Create an environment from that lockfile:
conda env create --name myenv --file conda-lock.yml
# if the format is not auto-detected:
conda env create --name myenv --file dev-lock.yml --env-spec=conda-lock-v1
Pixi / rattler lock v6:
conda export --name myenv --format pixi-lock-v6 --file pixi.lock
conda env create --name myenv --file pixi.lock --env-spec=pixi-lock-v6
Learning more#
New to conda-lockfiles? Start here to learn the essentials
Read about why conda-lockfiles exists and when you should use it