Overview#
The conda configuration file, .condarc
, is an optionalruntime configuration file that allows advanced users toconfigure various aspects of conda, such as which channels itsearches for packages, proxy settings, and environmentdirectories. For all of the conda configuration options,see the configuration page.
Note
A .condarc
file can also be used in anadministrator-controlled installation to override the users’configuration. See Administering a multi-user conda installation.
The .condarc
file can change many parameters, including:
Where conda looks for packages.
If and how conda uses a proxy server.
Where conda lists known environments.
Whether to update the Bash prompt with the currently activatedenvironment name.
Whether user-built packages should be uploaded toAnaconda.org.
What default packages or features to include in new environments.
Creating and editing#
The .condarc
file is not included by default, but it isautomatically created in your home directory the first time yourun the conda config
command. To create or modify a .condarc
file, open a terminal and enter the conda config
command.
The .condarc
configuration file follows simpleYAML syntax.
Example:
conda config --add channels conda-forge
Alternatively, you can open a text editor such as Notepadon Windows, TextEdit on macOS, or VS Code. Name the new file.condarc
and save it to your user home directory or rootdirectory. To edit the .condarc
file, open it from yourhome or root directory and make edits in the same way you wouldwith any other text file. If the .condarc
file is in the rootenvironment, it will override any in the home directory.
You can find information about your .condarc
file by typingconda info
in your terminal. This will give you information aboutyour .condarc
file, including where it is located.
You can also download a sample .condarc file to edit in your editor and save to your userhome directory or root directory.
To set configuration options, edit the .condarc
file directlyor use the conda config --set
command.
Example:
To set the auto_update_conda option
to False
, run:
conda config --set auto_update_conda False
For a complete list of conda config commands, see thecommand reference. The same listis available at the terminal by runningconda config --help
. You can also see the conda channelconfiguration for more information.
Conda supports a wide range of configuration options. This pagegives a non-exhaustive list of the most frequently used options andtheir usage. For a complete list of all available options for yourversion of conda, use the conda config --describe
command.
Searching for .condarc#
Conda looks in the following locations for a .condarc
file:
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/", "$XDG_CONFIG_HOME/conda/.condarc", "$XDG_CONFIG_HOME/conda/condarc", "$XDG_CONFIG_HOME/conda/condarc.d/", "~/.config/conda/.condarc", "~/.config/conda/condarc", "~/.config/conda/condarc.d/", "~/.conda/.condarc", "~/.conda/condarc", "~/.conda/condarc.d/", "~/.condarc", "$CONDA_PREFIX/.condarc", "$CONDA_PREFIX/condarc", "$CONDA_PREFIX/condarc.d/", "$CONDARC",)
XDG_CONFIG_HOME
is the path to where user-specific configuration files shouldbe stored defined following The XDG Base Directory Specification (XDGBDS). Defaultto $HOME/.config should be used.CONDA_ROOT
is the path for your base conda install.CONDA_PREFIX
is the path to the current active environment.CONDARC
must be a path to a file named .condarc
, condarc
, or end with a YAML suffix (.yml
or .yaml
).
Note
Any condarc files that exist in any of these special search pathdirectories need to end in a valid yaml extension (".yml" or ".yaml").
Conflict merging strategy#
When conflicts between configurations arise, the following strategies are employed:
Lists - merge
Dictionaries - merge
Primitive - clobber
Precedence#
The precedence by which the conda configuration is built out is shown below.Each new arrow takes precedence over the ones before it. For example, configfiles (by parse order) will be superseded by any of the other configurationoptions. Configuration environment variables (formatted like CONDA_<CONFIG NAME>
)will always take precedence over the other 3.
![Using the .condarc conda configuration file — conda 24.5.1.dev42 documentation (1) Using the .condarc conda configuration file — conda 24.5.1.dev42 documentation (1)](https://i0.wp.com/docs.conda.io/../../_images/config-precedence.png)
Obtaining information from the .condarc file#
You can use the following commands to get the effective settings for conda.The effective settings are those that have merged settings from all the sourcesmentioned above.
To get all keys and their values:
conda config --get
To get the value of a specific key, such as channels:
conda config --get channels
To show all the configuration file sources and their contents:
conda config --show-sources
Saving settings to your .condarc file#
The .condarc
file can also be modified via conda commands.Below are several examples of how to do this.
To add a new value, such ashttp://conda.anaconda.org/mutirri, to a specific key, such aschannels:
conda config --add channels http://conda.anaconda.org/mutirri
To remove an existing value, such ashttp://conda.anaconda.org/mutirri from a specific key, such aschannels:
conda config --remove channels http://conda.anaconda.org/mutirri
To remove a key, such as channels, and all of its values:
conda config --remove-key channels
To configure channels and their priority for a singleenvironment, make a .condarc
file in the root directoryof that environment.
Sample .condarc file#
Because the .condarc
file is just a YAML file, it means thatit can be edited directly. Below is an example .condarc
file:
# This is a sample .condarc file.# It adds the r Anaconda.org channel and enables# the show_channel_urls option.# channel locations. These override conda defaults, i.e., conda will# search *only* the channels listed here, in the order given.# Use "defaults" to automatically include all default channels.# Non-url channels will be interpreted as Anaconda.org usernames# (this can be changed by modifying the channel_alias key; see below).# The default is just 'defaults'.channels: - r - defaults# Show channel URLs when displaying what is going to be downloaded# and in 'conda list'. The default is False.show_channel_urls: True# For more information about this file see:# https://conda.io/docs/user-guide/configuration/use-condarc.html