3

Anaconda and conda are out of sync. Anaconda appears to create conda environments by default in a different place from conda, and conda info --env shows duplicated outputs, one with an upper and lower case version of the same environment name.

The fact that conda and Anaconda create directories in 2 different places is an issue. They should be synchronized by default. Sometimes I create environments with Navigator, sometimes with the conda command line.

If I specify a new environment with an upper case name, conda info --envs reports it twice (sometimes). This is not a big issue. However, it is confusing to newbies or annoying to not-so-newbies.

The output of conda info --envs is:

# conda environments:
#
base                     C:\ProgramData\Anaconda3
Rpy2                     C:\ProgramData\Anaconda3\envs\Rpy2
dash_plotly              C:\ProgramData\Anaconda3\envs\dash_plotly
genepattern           *  C:\ProgramData\Anaconda3\envs\genepattern
hranalytics              C:\ProgramData\Anaconda3\envs\hranalytics
my_hranalytics           C:\ProgramData\Anaconda3\envs\my_hranalytics
rpy2                     C:\ProgramData\Anaconda3\envs\rpy2
widgets-tutorial         C:\ProgramData\Anaconda3\envs\widgets-tutorial
BeakerX                  C:\Users\rlysakow\.conda\envs\BeakerX
R361                     C:\Users\rlysakow\.conda\envs\R361
beakerx                  C:\Users\rlysakow\.conda\envs\beakerx
Rpy2                     c:\ProgramData\Anaconda3\envs\Rpy2
dash_plotly              c:\ProgramData\Anaconda3\envs\dash_plotly

When I navigate to the parent directories, the "duplicated" environments with the same names, i.e., Rpy2 and rpy2 don't actually exist. Only one exists, with the upper case letters. The lower case instance appears to be some kind of artifact of Python or conda.

My versions of conda, Anaconda Navigator, and Python are as follows: conda version 4.8.2 Anaconda version 2019.10 Python version 3.7.4

c:\programdata\Anaconda3 is my default Anaconda installation location. I don't know why it started creating environments in the directory C:\Users\username\.conda\envs\ directory. I saw this in my environments on a totally different computer last year.

I know how to force conda to create new environments in a specific location by specifying it on the command line, or navigating there first. However, I don't want to have to use conda for all environment creation task.

Here's a little more information:

When I execute conda info I get the following output in my Anaconda base environment:

(base) C:\00-RSL\conda-envs>conda info

     active environment : base
    active env location : C:\ProgramData\Anaconda3
            shell level : 1
       user config file : C:\Users\rlysakow\.condarc
 populated config files : C:\Users\rlysakow\.condarc
          conda version : 4.8.2
    conda-build version : 3.18.9
         python version : 3.7.4.final.0
       virtual packages :
       base environment : C:\ProgramData\Anaconda3  (writable)
           channel URLs : https://conda.anaconda.org/r/win-64
                          https://conda.anaconda.org/r/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\rlysakow\.conda\pkgs
                          C:\Users\rlysakow\AppData\Local\conda\conda\pkgs
       envs directories : C:\ProgramData\Anaconda3\envs
                          C:\Users\rlysakow\.conda\envs
                          C:\Users\rlysakow\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.4 Windows/10 Windows/10.0.17763
          administrator : True
             netrc file : None
           offline mode : False

How do I configure Anaconda and conda both to always create all new environments in c:\programdata\anaconda3 ?

Rich Lysakowski PhD
  • 2,702
  • 31
  • 44

2 Answers2

2

If I understand the question correctly, there are a couple possible solutions.

  1. Specify desired envs directory explicitly every time you create the environment. To do this you can type:

    conda create --prefix=/users/.../yourEnvName python=x.x

  2. Configure the environment path variable used by conda. To do this you can type:

    conda config --append envs_dirs /path/to/envs

Also, link to similar question that I found helpful for a related issue how to specify new environment location for conda create.

jelc
  • 35
  • 6
  • Thank you. Your second answer is what I wanted, to be able to set it and forget it, and not have to specify the location every time I create a new environment. – Rich Lysakowski PhD Oct 18 '22 at 04:54
1

I was using Anaconda with Anaconda.Navivator (2.1.0) on Windows 10. It used to store environments in folder C:\ProgramData\Anaconda3\envs, but at some point started using other path: C:\Users\UserName.conda\envs. This is inconvenient to use with IDE's so I'd like all envs to be in one place, but I seem to be missing where can I configure this.

I tried conda config --set envs_dirs C:\ProgramData\Anaconda3\envs

But it gives me error CondaValueError: Key 'envs_dirs' is not a known primitive parameter.

What helped me was this answer. I found file .condarc in C:\Users\UserName\ and added a few lines there. After this Anaconda.Navigator started creating new envs in original folder and all envs were visible from IDEs:

envs_dirs:
  - C:\ProgramData\Anaconda3\envs
Rustam A.
  • 809
  • 8
  • 15