Skip to content

Instantly share code, notes, and snippets.

@kentwait
Last active January 11, 2024 04:06
Show Gist options
  • Save kentwait/72c74b7c08948cb682e59c3e325377a4 to your computer and use it in GitHub Desktop.
Save kentwait/72c74b7c08948cb682e59c3e325377a4 to your computer and use it in GitHub Desktop.
Create conda-lock of current Conda environment
# Run this script in the directory where you want to save the conda-lock file at
# Activate env to make a `conda-lock.yml` file of
# conda activate venv
# Export env spec list using conda/mamba as `environment.yml`
conda env export > environment.yml
# Make conda-lock file
# Edit platform tag `-p`
# For multiple platforms just add more, e.g. `-p osx-64 -p linux-64`
conda-lock -f environment.yml -p linux-64
# When new packages are installed, the conda environment changes and
# the environment.yml and conda-lock.yml files need to be updated.
# To re-solve the conda-lock file, uncomment the following line
#conda-lock -f environment.yml --lockfile conda-lock.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment