Does the first path in CONDA_ENVS_PATH serve as the default for new conda environments?

Viewed 29

I'm attempting to configure a number of (Windows) workstations so that when users create new conda environments, they are created along with their packages outside of the user profile (which can hurt roaming profile performance).

miniconda is installed to C:\anaconda3

I am setting the documented environment variable CONDA_ENVS_PATH to the following, to allow these users (GIS users) to also call their Esri conda environment along with their own personal environments:

D:\conda\envs;C:ArcGIS\Pro\bin\Python\envs;C:\anaconda3\envs

I'd like all environments created by a user to by default go to their D:\conda\envs path. Will this config accomplish this? If not, what will?

1 Answers

One can check this by testing, e.g., in bash1

$ CONDA_ENVS_DIRS="/a/envs,/b/envs" conda config --show envs_dirs
envs_dirs:
  - /one/envs
  - /two/envs
  - /Users/user/miniconda3/envs
  - /Users/user/.conda/envs

which confirms that, yes, the first path becomes the default, since the order in the computed settings it outputs is what is used.

Some things to note:

  1. CONDA_ENVS_PATH is an old variable name that is only kept around for backwards compatibility. Since v4.2, Conda uses the configuration variable envs_dirs to manage where environments are stored. Users controlling this through environment variables should be using CONDA_ENVS_DIRS these days.
  2. At least in Linux and macOS, Conda uses commas to separate multiple paths for this setting.
  3. Environment variables are the highest priority of the configuration sources, so generally I prefer deploying configuration settings through .condarc, which can be located at multiple levels (e.g., base prefix, user home). That way, environment variables are available for overriding defaults.

[1] Sorry I don't have Windows to show there, but should behave similarly.

Related