Skip to content

Instantly share code, notes, and snippets.

@mfansler
Last active February 16, 2021 03:36
Show Gist options
  • Save mfansler/7e7307101c5e3ceb47e379877187214e to your computer and use it in GitHub Desktop.
Save mfansler/7e7307101c5e3ceb47e379877187214e to your computer and use it in GitHub Desktop.
Script to archive Conda environments to YAML
#!/bin/bash -le
# Usage: ./conda-archive.sh foo
# Result: creates "foo.full.yaml", "foo.min.yaml", and removes "foo" environment
echo "Archiving environment '$1' to YAML"
conda env export -vn $1 > $1.full.yaml
conda env export -vn $1 --from-history > $1.min.yaml
echo "Removing environment '$1'"
conda env remove -vn $1
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment