Anaconda Server CLI

The Anaconda Server command line interface (CLI) is a tool that can be used to do the following:

  • Install packages from private or authenticated channels

  • Configure channels, default channels, and the channel alias

  • Upload assets

  • Create mirrors

This topic provides guidance on the following actions:


Installing the conda repo CLI

Install the Anaconda Server CLI conda-repo-cli package:

conda install conda-repo-cli

Note

The Anaconda Server administrators may also choose to mirror this package into a channel on the server. Contact your administors to determine if conda-repo-cli can be installed from an Anaconda Server channel.

Conda repo configuration

Follow these steps to configure your conda repo site:

  • Use the following commands if you are using SSL:

    # Replace <SITE_NAME> with the short tag you'll use to identify the fully qualified domain name.
    # Replace <DOMAIN> with your domain.
    conda repo config --set sites.<SITE_NAME>.url https://<DOMAIN>/api
    conda repo config --set default_site <SITE_NAME>
    
    # The following is an example of two sites, one for production and the second for development:
    # conda repo config --set sites.production.url https://prod.my-ate.company.com/api
    # conda repo config --set sites.development.url https://dev.my-ate.company.com/api
    
  • Use the following commands if you are not using SSL:

    # Replace <SITE_NAME> with the short tag you'll use to identify the fully qualified domain name.
    # Replace <DOMAIN> with your domain.
    conda repo config --set sites.<SITE_NAME>.url http://<DOMAIN>/api
    conda repo config --set default_site <SITE_NAME>
    

For example, <SITE_NAME> may be anaconda-repo and <DOMAIN> may be anaconda-repo.company.com.

OAuth and SAML configuration

If you are using OAuth or SAML, run the following command to go through the standard SAML authorization flow after configuring your site:

conda repo config --set oauth2 true

when you run conda repo login, a browser window will open for you to log in to Anaconda Server. After login has completed, the window will display “Token Received.” You can then close the browser window and continue to use the CLI.

Logging in

Run the following code to log in to Anaconda Server:

conda repo login # You will be prompted to enter your Anaconda Server username and password

Now you will be able to install packages from private and authenticated channels you have access to.

Using the wizard

Use the Anaconda Server CLI conda repo wizard command to configure channels and default_channels while setting a channel_alias for them. You can also use the command to backup and restore your .condarc file.

  1. Log into your instance of Anaconda Server.

  2. Run the command:

conda repo wizard
  1. Enter the channels you wish to set to your default_channels list, separated by a space. You must set a default channel before proceeding.

  2. Enter the channels you want to add to the channels list, separated by a space. Leave this blank if you do not need to add any additional channels.

Note

Channel names must be exact. Misspelled channel names will not be accepted, for both the default_channels and channels lists. If you enter a channel name that does not match an existing channel in your instance, a warning appears and no channel is added to the list.

Your output will look something like this:

Conda configuration wizard.
This wizard will configure your CondaRC file using channels from https://<YOUR_DOMAIN>

The following channels are available:
Name                           | Mirror | Privacy         | Owners
---------------------------------------------------------------------------
main                           |  ︎ ✔    | public          | anaconda-admin
msys2                          |  ︎ ✔    | public          | anaconda-admin
r                              |  ︎ ✔    | public          | anaconda-admin
anaconda-admin                 |  ︎      | public          | anaconda-admin

Provide a space-separated list of channels to set as default_channels
It is common to add mirror channels here.
: main r

If you wish to add channels to the "channels" list
provide a space-separated list. You may leave this blank.
:
The following Conda configuration will be applied
channel_alias: https://<YOUR_DOMAIN>
default_channels:
  - main
  - r
channels:
  - defaults
Confirm (Your current condarc file will be archived) [Y, n]: y
Backing up your current condarc file to /Users/<USER>/.condarc.backup

You can now restore your .condarc file at any time, if necessary. To do this, run the command:

conda repo wizard --restore

This overwrites your current .condarc configuration with the configuration you’ve backed up.

Further assistance

For a more robust view of conda repo commands, run the command:

conda repo --help

Similarly, appending --help or the shorthand -h to a command will provide you with further actions you can take, such as the following:

conda repo mirror -h
conda repo channel -h
conda repo upload -h
conda repo wizard -h