Last active
January 12, 2023 03:54
-
-
Save lesterlo/79c085a0a3e8cad33f5d74014a823ad3 to your computer and use it in GitHub Desktop.
Backup all environment from anaconda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place this to your home directories | |
# If you use this config, all of the envs will store into your home directories | |
channels: [conda-forge] | |
auto_activate_base: false | |
envs_dirs: | |
- /Users/"YOUR_HOME_DIR"/.conda/envs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# From: https://stackoverflow.com/questions/60508333/export-all-created-conda-environments | |
for env in $(conda env list | cut -d" " -f1); do | |
if [[ ${env:0:1} == "#" ]] ; then continue; fi; | |
conda env export -n $env > ${env}.yml | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (( $# == 0 )); then | |
echo "No arguments provided" | |
exit 1 | |
fi | |
if (( $# > 1 )); then | |
echo "Invalid arguments provided" | |
exit 1 | |
fi | |
for entry in "$1"/*.yml | |
do | |
echo "Recovering: $entry" | |
conda env create -f $entry | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment