Introduction

Nexus OSS 3 has support for lots of tools like Maven, NPM, Ruby Gem and so on but for Python only PIP repository is supported, there is no support for Anaconda/Miniconda.

In this post I will explain how to use RAW repository to configure a proxy for Anaconda repository for https://repo.continuum.io.

Prerequisite

  1. Nexus OSS 3 (I tested it with 3.9 also this should work with Pro version)
  2. Admin access to the nexus.

I’m not going to explain how to install Nexus OSS 3.

Nexus Download Page

How to Implement

Since there is no Anaconda Support (yet) in Nexus 3 we will be using Nexus Raw repository to create a proxy to the Anaconda repository in https://repo.continuum.io

Creating Proxy

To create the proxy do the following.

  1. Logon to the nexus with an admin user and click the gear icon on the top menu which is next to the search bar.
  2. Select Repositories from side menu.
  3. Click Create Repository
  4. Select “raw (proxy)” from the list of recipies.
  5. Enter the name (which will be part of the url) lets say “anaconda”
  6. In remote URL enter https://repo.continuum.io
  7. If you have more than one blob store then select a blob store.
  8. Save it.

Now we have configured a proxy repository to be used in Anaconda/Miniconda.

Client Configuration

To configure the “conda” client to us the nexus edit the ~/.condarc in *nix and %USERPROFILE%\.condarc in Windows and have the following content.

If your Nexus Server is running in http://repository.company.com then the .condarc content will be

channels:
  - http://repository.company.com/repository/anaconda/pkgs/main/
  - http://repository.company.com/repository/anaconda/pkgs/free/
  - http://repository.company.com/repository/anaconda/pkgs/r/
  - http://repository.company.com/repository/anaconda/pkgs/pro/
  - http://repository.company.com/repository/anaconda/pkgs/msys2/

Test the configuration by running conda info the result should be as the below

Karthik's - Terminal
$ conda info
     active environment : None
       user config file : /home/seenukarthi/.condarc
 populated config files : /home/seenukarthi/.condarc
          conda version : 4.5.11
    conda-build version : not installed
         python version : 3.7.0.final.0
       base environment : /home/seenukarthi/miniconda3  (writable)
           channel URLs : http://repository.company.com/repository/anaconda/pkgs/main/linux-64
                          http://repository.company.com/repository/anaconda/pkgs/main/noarch
                          http://repository.company.com/repository/anaconda/pkgs/free/linux-64
                          http://repository.company.com/repository/anaconda/pkgs/free/noarch
                          http://repository.company.com/repository/anaconda/pkgs/r/linux-64
                          http://repository.company.com/repository/anaconda/pkgs/r/noarch
                          http://repository.company.com/repository/anaconda/pkgs/pro/linux-64
                          http://repository.company.com/repository/anaconda/pkgs/pro/noarch
                          http://repository.company.com/repository/anaconda/pkgs/msys2/linux-64
                          http://repository.company.com/repository/anaconda/pkgs/msys2/noarch
          package cache : /home/seenukarthi/miniconda3/pkgs
                          /home/seenukarthi/.conda/pkgs
       envs directories : /home/seenukarthi/miniconda3/envs
                          /home/seenukarthi/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Linux/4.15.0-36-generic ubuntu/18.04 glibc/2.27
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
    

Now you can use conda install <package name> it will be downloded through Nexus 3.