~/.conda/envs vs. ~/anaconda3/envs

Viewed 613

I was debugging some issues with Anaconda after an update to macOS Catalina recently and noticed that ~/.conda/envs was added to the configuration. This has broken a number dev environments for me, and I'm wondering...

Why am I seeing this new location for conda environments? Can I remove it and continue to use and create environments solely in ~/anaconda3/envs?

conda info
...
envs directories : /Users/me/.conda/envs
                   /Users/me/anaconda3/envs
...
1 Answers

According to this GitHub issue, the purpose of ~/.conda/envs is to provide conda with at least one directory that is guaranteed to be writable by the user.

The ~/.conda directory is no longer used on Windows, only unix. Conda's install location is not guaranteed to be user-writable. Conda always needs at least one user-writable location for the package cache (pkgs directory) and the envs directory where new named environments are created. The default location for these directories is ~/.conda on unix, and on Windows we use appdirs. The ~/.conda directory has been used for years on unix for this purpose.

When conda's install location is user-writable, then that's the location chosen as "first writable" for these two directories. When conda's install location is not writable by the current user, then conda uses the ~/.conda directory as the writable location, but is still able to use the install location for a read-only package cache and named environments. Compare output of conda config --show for the two different cases.

The locations of these directories can be overrode by configuration using the envs_dirs and pkgs_dirs configuration parameters, or CONDA_ENVS_DIRS and CONDA_PKGS_DIRS environment variables.

It should be safe to install environments only into ~/anaconda3/envs, as long as that is writable by the current user. For example, I only install environments into ~/miniconda3/envs and have faced no issues.

Related