Conda Channels

5 minute read

Conda Channels

Channels and why are they needed?: In most cases all Conda packages that you will encounter are published on the main or default channel of Anaconda Cloud. A Conda channel is an identifier of a path (e.g., as in a web address) from which Conda packages can be obtained.

Using the public cloud, installing without specifying a channel points to the main channel at https://repo.anaconda.com/pkgs/main; where hundreds of packages are available.

Although covering a wide swath, the main channel contains only packages that are (moderately) curated by Anaconda Inc. Given finite resources and a particular area focus, not all genuinely worthwhile packages are vetted by Anaconda Inc.

If you happen to be working in a firewalled or airgapped environment with a private installation of Anaconda Repository, your default channel may point to a different (internal) URL, but the same concepts will apply.

Anyone may register for an account with Anaconda Cloud, thereby creating their own personal Conda channel. We will learn about that later, but for now just understand that many users have accounts and corresponding channels.

A channel belongs to a user who wishes to publish resources.

Searching within channels

If a particular colleague or other recognized user may have published a package useful to you, you can search for it using the anaconda search command. For example, David Mertz, has a channel and Anaconda Cloud account called davidmertz. You can search his channel using the command below; the option –channel (or -c for short) specifies the channel to search. Particular users may have published more niche software you would like to use; for example, colleagues of yours may publish packages of special use in your field or topic area.

(base) shravan-projects# conda search --channel davidmertz --override-channels --platform linux-64
Loading channels: done
# Name                       Version           Build  Channel
accelerate                     2.2.0     np110py27_2  davidmertz
accelerate                     2.2.0     np110py35_2  davidmertz
accelerate-dldist                0.1     np110py27_1  davidmertz
accelerate-dldist                0.1     np110py35_1  davidmertz
accelerate-gensim             0.12.3    np110py27_96  davidmertz
accelerate-gensim             0.12.3    np110py35_96  davidmertz
accelerate-skimage             0.1.0          py27_1  davidmertz
accelerate-skimage             0.1.0          py35_1  davidmertz
constants                      0.0.2          py35_0  davidmertz
humidity                         0.1  py36ha038022_0  davidmertz
textadapter                    2.0.0          py27_0  davidmertz
textadapter                    2.0.0          py35_0  davidmertz
textadapter                    2.0.0          py36_0  davidmertz
(base) shravan-projects#

In this case, the switch –override-channels is used to prevent searching on default channels. The switch –platform is used to select a platform that may differ from the one on which the search is run (absent the switch, the current computer’s platform is used).

The first search is unusual in that it does not specify a package name, which is more typical actual use. For example, you might want to know which versions of the package of textadapter for the win-64 platform are available for any version of Python (assuming you know in which channels to look):

(base) shravan-projects# conda search -c conda-forge -c sseefeld -c gbrener --platform win-64 textadapter
Loading channels: done
# Name                       Version           Build  Channel
textadapter                    2.0.0          py27_0  conda-forge
textadapter                    2.0.0          py27_0  sseefeld
textadapter                    2.0.0 py27h0ff66c2_1000  conda-forge
textadapter                    2.0.0          py34_0  sseefeld
textadapter                    2.0.0          py35_0  conda-forge
textadapter                    2.0.0          py35_0  sseefeld
textadapter                    2.0.0          py36_0  sseefeld
(base) shravan-projects#

Suppose you wanted to find an osx-64 version of textadapter for Python 3.6 and you know the channels that you are going to search, you would run the following command:

(base) shravan-projects# conda search -c conda-forge -c sseefeld -c gbrener -c davidmertz --platform osx-64 textadapter
Loading channels: done
# Name                       Version           Build  Channel
textadapter                    2.0.0          py27_0  conda-forge
textadapter                    2.0.0          py27_0  gbrener
textadapter                    2.0.0          py27_0  davidmertz
textadapter                    2.0.0  py27h355e19c_0  conda-forge
textadapter                    2.0.0 py27h418f4c1_1000  conda-forge
textadapter                    2.0.0          py35_0  conda-forge
textadapter                    2.0.0          py35_0  gbrener
textadapter                    2.0.0          py35_0  davidmertz
textadapter                    2.0.0          py36_0  davidmertz
(base) shravan-projects#

In this case, only davidmertz channel has the package/platform/version that we are looking for.

Searching across channels

Suppose that you may know the name of the textadapter package, but you may not know in which channel (or channels) it may be published (or by which users). You can search across all channels and all platforms using:

(base) shravan-projects# anaconda search textadapter
Using Anaconda API: https://api.anaconda.org
Packages:
     Name                      |  Version | Package Types   | Platforms       | Builds
     ------------------------- |   ------ | --------------- | --------------- | ----------
     DavidMertz/textadapter    |    2.0.0 | conda           | linux-64, osx-64 | py36_0, py35_0, py27_0
     conda-forge/textadapter   |    2.0.0 | conda           | linux-64, win-32, osx-64, win-64 | py27h355e19c_0, py27h0ff66c2_1000, py27h418f4c1_1000, py35_0, py27_0
     gbrener/textadapter       |    2.0.0 | conda           | linux-64, osx-64 | py35_0, py27_0
                                          : python interface Amazon S3, and large data files
     sseefeld/textadapter      |    2.0.0 | conda           | win-64          | py36_0, py34_0, py35_0, py27_0
                                          : python interface Amazon S3, and large data files
     stuarteberg/textadapter   |    2.0.0 | conda           | osx-64          | py36_0
Found 5 packages

Run 'anaconda show <USER/PACKAGE>' to get installation details
(base) shravan-projects#

Default, non-default, and special channels

The default channel on Anaconda Cloud is curated by Anaconda Inc., but another channel called conda-forge also has a special status. This channel does not operate any differently than other channels, whether those others are associated with an individual or organization, but it acts as a kind of “community curation” of relatively well-vetted packages. The GitHub page for the conda-forge project at https://github.com/conda-forge describes it as: “A community led collection of recipes, build infrastructure and distributions for the conda package manager.”

Apart from the somewhat more organized conda-forge channel/project, Anaconda Cloud channels are relatively anarchic. Much like GitHub repos or packages on the Python Package Index (PyPI), anyone is free to upload whatever projects they like to conda-forge (as long as they are assembled as Conda packages, that is, but this is a minor restriction).

You should generally trust or rely only on packages sourced from reputable channels. There is no inherent rating system for channels or their packages. However, you are likely to trust your colleagues, your organization, well-known people in your software or data science communities, and so on.

conda-forge is almost certainly the most widely used channel on Anaconda Cloud. In fact, it has very many more packages than the main channel itself.

There are about hundered thousand packages available on conda-forge for linux-64 platform.

(base) $ conda search -c conda-forge --platform linux-64 | wc -l
182387
(base) $

Installing packages from a channel

There are around 2500 channels that have been active in the last 6 months; most are individual users, but a fair number belonging to projects or organizations. A majority of package names are published by more than one different channel; sometimes just as a copy, other times with a tweak or compiler optimization, or in a different version.

The whole point of having channels is to be able to install packages from them.

For this example, you will install a version of a package not available on the default channel. Adding a channel to install from simply requires using the same –channel or -c switch we have seen in other conda commands, but with the conda install command.

conda install –channel my-organization the-package

Example: Install youtube-dl from conda-forge which is not available on the default channel.

conda install -c conda-forge youtube-dl

Tags:

Updated: