Launch Anconda3 from backup

Viewed 78

Tried running Anaconda back up on new computer from bash but it did not work. So I downloaded Anaconda3 again.

I have a backup from my stolen computer. I can see anaconda3 folder and inside I can find envs folder. Inside there is a folder for each of my environments. Unfortunately when I open the specific environment folders, I cannot find any .yml file. Note: I never exported any environment to yml file before.

Unfortunately, I cannot import any of my former environments, as I cannot find any .yml/yaml file.

Can anyone shed some light on how to find or generate a yml file from backed up environments (inside envs folder)?

1 Answers

One should be able to activate the environments by using the prefix (path):

conda activate /path/to/the/backup/anaconda3/envs/foo

One way to possibly recreate them on the new system would be through cloning. For example,

conda create --clone /path/to/the/backup/anaconda3/envs/foo -n foo

Or you can do as suggested and dump YAMLs:

## use the `-p` (prefix) flag to specify by path
conda env export -p /path/to/the/backup/anaconda3/envs/foo > foo.yaml

Alternatively, if the backup is going to be permanently mounted, the location could be added to envs_dirs, and this should re-enable referring to them by name:

## use `--append` so new environments are not created there
conda config --append envs_dirs /path/to/the/backup/anaconda3/envs

In practice, however, this may have issues resolving dynamically-linked libraries that used absolute paths. The cloning strategy might be better.

Related