Conda Repositories
Introduction
"Package, dependency and environment management for any language---Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN
Conda is an open-source package management system and environment management system that runs on Windows, macOS, and Linux. Conda quickly installs, runs and updates packages and their dependencies. Conda easily creates, saves, loads, and switches between environments on your local computer. It was created for Python programs but it can package and distribute software for any language."
You can create a proxy repository in Nexus Repository Manager that will cache packages from a remote anaconda repository, like Continuum, Conda-Forge and Anaconda. Then, you can make the Conda client use your Nexus Repository proxy instead of the remote repository.
Note
This format is disabled in HA-C environments.
Supported Features
Conda versions - 4.6 and newer
Conda package formats -
.conda
andtar.bz2
Repository types - Proxy
Repository Configuration
Proxying the Conda Repository
To proxy a Conda repository, you simply create a new conda (proxy) as documented in Repository Management in detail.
Minimal configuration steps are:
Define Name - e.g. conda-proxy
Define URL for Remote storage - e.g.
https://repo.anaconda.com/pkgs/
Select a Blob store for Storage
Connecting to Conda Cloud with a Token
If you are connecting repository manager to Conda Cloud using a token, you will need to add the token value to the Conda proxy repository Remote URL value.
For example, you might use https://repo.anaconda.cloud/t/<TOKEN>/repo/main/
and replace <TOKEN>
with the actual token value.
Configuring the Conda Client to Use Nexus Repository
Using the Conda client, you can now download packages from your Nexus Repository Conda proxy like so:
$ conda install -c <protocol>://<user>:<password>@<hostname>:<port>/repository/<repository_name>/main numpy
Note
<user>:<password>@
is required if authenticated access is required for <repository_name>
content.
<protocol>
is "http" or "https".
The command above tells Conda to fetch (and install) packages from your Nexus Repository Conda proxy. Nexus Repository will download and cache any non-proxied packages from the remote Conda repository. The next time any client requests the same package from your Nexus Repository Conda proxy, it will return the already cached package.
After these changes, you can install packages without directly specifying a channel as follows:
$ conda install numpy
Using Nexus Repository Exclusively
If you are using the Conda client only with Nexus Repository, you can add channels to the Conda repositories in the .condarc file and remove the default channels:
$ conda config --add channels <protocol>://<user>:<password>@<hostname>:<port>/repository/<repository_name>/main $ conda config --remove channels defaults
And also set the channel_alias
in the ~/.condarc file to be the URL of your conda repository with "/conda
" appended to the end of it:
# Note: You must add the "conda" subdirectory to the end channel_alias: <protocol>://<user>:<password>@<hostname>:<port>/repository/<repository_name>/main/conda
Note
<user>:<password>@
is required if authenticated access is required for <repository_name>
content.
<protocol>
is "http" or "https".