Channels
A channel is a location where conda can search for packages to install in environments on your machine. Conda finds these channels via URL, name, or file path, depending on your setup.
Examples
URL | https://conda.anaconda.org/conda-forge |
Name | conda-forge |
File Path | file:///local-dev-channels/my-channel |
Viewing your channels
To see which channels conda is currently configured to use, open Anaconda Prompt (Terminal on macOS/Linux) and run the following command:
Example return:
To manage the channels:
list in your .conadrc
file, see Managing channel configuration.
Opening your .condarc file
To locate your .condarc
file, open Anaconda Prompt (Terminal on macOS/Linux) and run the following command:
Example return:
While the .condarc
is most likely in your Home directory, it is a hidden file on MacOS and Linux and is not visible in file browsers under under normal circumstances.
You can view hidden files and folders using the following guidance for your operating system:
To view hidden files on macOS, use Shift+Cmd+. in your Finder.
To view hidden files on macOS, use Shift+Cmd+. in your Finder.
To view hidden files on Linux, use Alt+. or Ctrl+H (depending on your file manager).
For more information on the .condarc
file, see Using the .condarc conda configuration file in the official conda documentation.
Managing the default channels
When you first install conda via the Anaconda Distribution or Miniconda installers, it comes configured to use a set of default channels:
https://repo.anaconda.com/pkgs/main
https://repo.anaconda.com/pkgs/r
https://repo.anaconda.com/pkgs/msys2
(Windows only)
These default channels are built and hosted by Anaconda and are subject to Anaconda’s Terms of Service.
The default channels shipped with Anaconda Distribution and Miniconda can be changed or removed, if necessary, by editing your conda configuration file (.condarc
) or by deleting the defaults
channel entirely.
- Open your
.condarc
file. - Add the following lines to the bottom of the file:
Adding channel URLs to the default_channels:
list overwrites the channels hardcoded into defaults
.
- Open your
.condarc
file. - Add the following lines to the bottom of the file:
Adding channel URLs to the default_channels:
list overwrites the channels hardcoded into defaults
.
Do not remove defaults
from your channels:
list if it is the only channel that you have configured in your .condarc
file(s). This will cause conda to error. Before you remove defaults
, add another channel to your channels:
list to replace it.
Remove defaults
from your channels:
list by running the following command:
For more information on default channels, see Default channels.
Managing channel configuration
You might need packages that aren’t available in the default channels provided to you by your Anaconda Distribution or Miniconda installer. Some popular additional channels include:
- conda-forge: A community-maintained channel with a vast collection of packages
- bioconda: A community-maintained channel for specialized bioinformatics packages
Channels can be configured by manually editing your .condarc
file or by using conda commands in your Anaconda Prompt (Terminal for macOS/Linux).
Keep channel priority in mind when configuring your channels.
-
Open your
.condarc
file. -
Add your channel name or URL to the
channels:
list.For example, if you want to add conda-forge to your channels list below the
defaults
channel, yourchannels:
list would look like the following:
-
Open your
.condarc
file. -
Add your channel name or URL to the
channels:
list.For example, if you want to add conda-forge to your channels list below the
defaults
channel, yourchannels:
list would look like the following:
Manage the channels in your channels:
list by opening Anaconda Prompt (Terminal in macOS/Linux) and running the following command:
Command flag | Description |
---|---|
--add | Add one or more channels to the end of your channels: list. |
--append | Add one channel to the end of your channels: list. |
--prepend | Add one channel to the beginning of your channels: list. |
--remove | Remove one channel from your channels: list. |
For example, if you wanted to add two channels from Anaconda.org to the end of your channels:
list and you have the default channel alias set, your command might look like the following:
Channel priority
Conda searches for requested packages in the channel listed at the top of the channels:
list first. If that channel contains the requested package, it is downloaded from that channel.
If the requested package is not located in that channel, conda will search for the package in the next entry of the channels:
list.
When conda reaches the defaults
entry of the channels:
list, it searches the channels listed under the default_channels:
list, in the same descending order. This is called “channel priority”.
Installing packages from a specific channel
You can install packages from the channels listed in your .condarc
with the simplest version of the conda create
, conda install
or conda update
commands, but if you want to specify a specific channel, you can do so in two ways: using the channel::package
syntax or using the --channel
flag. These methods both install a package from the channel you specify, but do so in slightly different ways.
channel::package syntax
This syntax installs the package from the specified channel, but installs that package’s dependencies from the channels in your .condarc
file, following channel priority order.
This is the recommended syntax for installing packages from a specific channel, as it is the least invasive to your environment.
—channel flag
This flag installs the package and the package’s dependencies from the specified channel. The channel you specify will temporarily be the top priority channel in your channels list. If any dependencies are not found in the specified channel, conda searches down the rest of your channels in priority order.
Using the --channel
flag is only recommended when creating temporary or test environments or if you are an expert conda user, as more packages might end up being installed or updated from the specified channel than intended.
If you find yourself using the --channel
flag often, consider adding the specified channel to your channels list, so you can better control how conda gets packages.
Changing your channel alias
You can type out an entire URL when installing packages, such as conda install https://conda.anaconda.org::<PACKAGE>
, but specifying a long and complex channel URL every time you want to install a package takes time and might lead to mistakes. To improve your experience and streamline your workflows, conda allows you to implement a channel alias.
Your channel alias is used to automatically complete the channel address when installing conda packages. Conda prepends the provided channel name with the channel alias to create the full channel URL it requires to locate packages. By default, your channel alias is https://conda.anaconda.org
, which is the domain name for Anaconda.org.
For example, the conda-forge channel is hosted at anaconda.org/conda-forge. With the default channel alias in place, you can just type the channel name conda-forge
when specifying the package, instead of the longer https://conda.anaconda.org/conda-forge
.
Channel aliases can also be used to point to different hosting places, such as the premium repositories Anaconda offers through our paid tiers. For more information on the channel alias, see channel_alias: Set a channel alias in the official conda documentation.
For more information on creating channels within your own local computer files, see Creating custom channels in the official conda documentation.
Was this page helpful?