6

I have a lot of conda envs in my C:\Users\username\.conda\envs directory. I have been facing a lot of memory issues due to this. I was planing on doing a complete reinstall of Anaconda in my D drive. But I wanted to confirm that this would actually create envs in my D drive and not in my C drive.

Also, if it does create envs in D then does copy-pasting the environment folders from C:\Users\username\.conda\envs into the newly created envs successfully restore my conda envs?

  • 2
    There is a `env_dirs` configuration variable in `.condarc` that you may want to have a look at: https://stackoverflow.com/questions/35280479/can-i-choose-where-my-conda-environment-is-stored Generally moving environments by moving the folders will lead to problems (e.g. scripts may not find the python interpreter). Exporting to a yaml file and reinstalling however may work fine. I would for sure make a backup before trying this tho. – cel May 25 '20 at 07:53
  • @cel will reinstalling in D put the envs in D? – Sabito stands with Ukraine May 25 '20 at 08:02
  • I think so, if not you can always choose a location of choice by setting the `env_dirs` variable. – cel May 25 '20 at 08:53
  • 2
    I think you need to specify both the `envs_dirs` and the `pkgs_dirs`. See `conda config --describe pkgs_dirs envs_dirs`. As long as they're on the same drive, then hardlinking will work (maximizing space saving). I'm not on Windows, so I can't confirm the installation behavior. Also, I'd recommend install Miniconda as your **base**, instead of Anaconda. – merv May 25 '20 at 21:50

1 Answers1

2

From Anaconda docs: Moving Anaconda from one directory to another:

Anaconda environment management requires known paths, and Anaconda must know the exact path where it is installed at installation time.

If you simply copy the Anaconda files to a new directory, Anaconda will not work.

To move Anaconda from one directory to another:

OPTIONAL: Save your environments using the conda managing environments instructions.

  1. Uninstall Anaconda.
  2. Go to the new directory and install it there following the Anaconda installation instructions.

OPTIONAL: Restore your environments using the conda managing environments instructions.