Search code examples
condaminiconda

How to modify the location of .condarc file?


I have recently installed Miniconda3 on windows. Conda expects the .condarc file to be located in the windows "home directory" C:\Users\user.name\.condarc.

How can I tell conda to look for a .condarc file in a different location?


Solution

  • TL;DR: You can set CONDARC=/path/to/.condarc or put the file in one of the paths below.

    See the condarc documentation for a list of paths where conda searches for the .condarc file. You can place your .condarc any of these paths (the paths that apply to your operating system).

    I have included the relevant information below.

    if on_win:
     SEARCH_PATH = (
         'C:/ProgramData/conda/.condarc',
         'C:/ProgramData/conda/condarc',
         'C:/ProgramData/conda/condarc.d',
     )
    else:
     SEARCH_PATH = (
         '/etc/conda/.condarc',
         '/etc/conda/condarc',
         '/etc/conda/condarc.d/',
         '/var/lib/conda/.condarc',
         '/var/lib/conda/condarc',
         '/var/lib/conda/condarc.d/',
      )
    
     SEARCH_PATH += (
         '$CONDA_ROOT/.condarc',
         '$CONDA_ROOT/condarc',
         '$CONDA_ROOT/condarc.d/',
         '~/.conda/.condarc',
         '~/.conda/condarc',
         '~/.conda/condarc.d/',
         '~/.condarc',
         '$CONDA_PREFIX/.condarc',
         '$CONDA_PREFIX/condarc',
         '$CONDA_PREFIX/condarc.d/',
         '$CONDARC',
     )
    

    CONDA_ROOT is the path for your base conda install. CONDA_PREFIX is the path to the current active environment.

    If one has multiple .condarc files, conda will merge the information using the following strategies:

    • Lists - merge
    • Dictionaries - merge
    • Primitive - clobber [i.e., overwrite]