Skip to main content

Conda Repositories

Conda is an open-source package management system and environment management system that runs on Windows, macOS, and Linux. It was created for Python programs but it can package and distribute software for any language.

Create a proxy repository in Nexus Repository to cache packages from remote Anaconda repositories, such as Continuum, Conda-Forge , and Anaconda. Have the Conda client use the Nexus Repository proxy instead of the remote repository.

Supported Features

  • Conda versions - 4.6 and newer

  • Conda package formats - .conda and tar.bz2

  • Repository types - Proxy

Proxying the Conda Repository

To proxy a Conda repository, create a new Conda (proxy) with the following configuration steps.

  1. Enter a Name for the proxy

    conda-proxy

  2. Set the URL for Remote storage

    https://repo.anaconda.com/pkgs/

  3. Select a blob store

Downloading Packages

Download packages using the Conda proxy using the Conda client.

$ conda install -c <protocol>://<user>:<password>@<hostname>:<port>/repository/<repository_name> numpy

The credentials are appended to the URL when authenticated access is required by Nexus Repository.

The <protocol> is "HTTP" or "HTTPS"

The command tells Conda to fetch (and install) packages from your Nexus Repository Conda proxy. Nexus Repository downloads and caches packages from the remote Conda repository. When the client requests the package, the cached package is returned.

Connecting to Conda Cloud or a Private Channel with a Token

When connecting to the Conda Cloud or private channel using a token, include the token value to the Conda proxy repository's Remote URL value.

https://repo.anaconda.cloud/t/<TOKEN>/<CHANNEL>

See the Conda documentation on connecting to a private channel

Configuring the Conda Client

The conda configuration file, .condarc, is an optional runtime configuration file that allows advanced users to configure various aspects of conda, such as which channels it searches for packages, proxy settings, and environment directories.

See Conda documentation on .condarc file

There are a few ways that you may configure your Conda Client to use your Nexus Repository proxy when downloading packages.

Update the Available Channels

Listing channel locations in the .condarc file overrides the conda defaults, causing conda to search only the channels listed there in the order given.

When using the Conda client with Nexus Repository, add the Conda repository in the .condarc file and remove the default channels:

$ conda config --add channels <protocol>://<user>:<password>@<hostname>:<port>/repository/<repository_name>
$ conda config --remove channels defaults

See the Conda documentation on managing channels

After these changes, install packages without directly specifying a channel as follows:

$ conda install numpy

Run a conda search or conda install command to test the connection to the Conda-Forge channel through your Nexus proxy repository.

Set the Default Channels

Normally, the defaults channel points to several channels at the repo.anaconda.com repository, but when default_channels is defined, it sets the new list of default channels. This is useful for air-gapped and enterprise installations.

default_channels:
  - http://some.custom/channel

See the documentation on default channels

Set the Channel Alias

Whenever you use the -c or --channel flag to give conda a channel name that is not a URL, conda prepends the channel_alias to the name that it was given.

Set the channel_alias to the URL of your Conda repository.

channel_alias: <protocol>://<user>:<password>@<hostname>:<port>/repository/<repository_name>

For example, the command:

conda install --channel main <package>

is the same as:

conda install --channel https://conda.anaconda.org/main <package>

See the Conda documentation on using the channel alias

Conda Channels

Conda repositories, often referred to as channels, are the online locations where Conda packages are stored and retrieved. They serve as the base for hosting and managing packages. Conda packages are downloaded from remote channels, which are URLs to directories containing conda packages.

The conda command searches a set of channels. By default, packages are automatically downloaded and updated from the default channel, which may require a paid license, as described in the repository terms of service. The conda-forge channel is free for all to use. You can modify which remote channels are automatically searched; this feature is beneficial when maintaining a private or internal channel.

There are several key repositories available, each with its focus and characteristics:

Anaconda Default Channels

  • Main

    This is the primary channel maintained by Anaconda, containing a curated collection of popular and stable packages built with the latest compiler stack.

    https://repo.anaconda.com/pkgs/main
  • R

    Provides R language packages, including those from Microsoft R Open and Anaconda. This is included in the "defaults" channel.

    https://repo.anaconda.com/pkgs/r
  • MSYS2

    Specifically for Windows, this channel provides essential tools and libraries for building and running software on Windows.

    https://repo.anaconda.com/pkgs/msys2

Conda-Forge proxy

A community-driven channel with a vast collection of packages. Conda-Forge emphasizes open-source contributions and provides a wider range of packages, including those not available in the default channels. It's known for its up-to-date packages and active community support.

https://conda.anaconda.org/conda-forge/

Important

As of 2024, the conda-forge is incompatible with the packages provided in defaults.

See the Conda-forge documentation Transitioning From Defaults

Considerations When Choosing Channels

  • Package Availability: Different channels offer different packages. Conda-Forge generally has the widest selection.

  • Package Updates: Conda-Forge is often quicker to update packages to newer versions.

  • Community Support: Conda-Forge has a large and active community, making it easier to find help and contribute.

  • Stability: Anaconda's default channels prioritize stability, while Conda-Forge may include more cutting-edge (and potentially less stable) versions.