Skip to content

Latest commit

 

History

History
71 lines (56 loc) · 1.74 KB

Anaconda envs migration.md

File metadata and controls

71 lines (56 loc) · 1.74 KB

Migrating your conda environment(s)

Installed your environment on /home? No worries! Let's move it to /scratch!

Do you have a .condarc file?

cat ~/.condarc

Skip the next step if the answer is yes. O.w., create it

touch ~/.condarc

Set your user name into a variable (so we can use it later as $user_name)

user_name=<your_username>

Add your /scratch path to your .condarc (to set it as the default path for env installations)

conda config --prepend envs_dirs /scratch/$user_name/envs

Remove your /home path from your .condarc (This command will work only if this path appears in it, i.e., in case you previously actively added it; O.w., it will return an error. That's fine.)

conda config --remove envs_dirs /home/$user_name/envs 

Make sure your .condarc changes were properly applied (should see /scratch path but not /home)

cat ~/.condarc

Repeat the following five steps for each of your (/home) environments

  1. Set your env_name into a variable (so we can use it later as $env_name)
env_name=<your_env_name>
  1. Activate your environment
conda activate $env_name
  1. Export the environment without prefix
conda env export --no-builds | grep -v "^prefix: " > $env_name.yml
  1. Deactivate and remove the old environment (to free up /home and your environment name)
conda deactivate
conda env remove -n $env_name
  1. Re-create your environment on /scratch from the yml in the new location
conda env create -n $env_name -f $env_name.yml

Verify the new environment's path

conda env list

Now you shold be able to activate your migrated environment(s) (hip hip hooray!)

conda activate $env_name