Setting up a custom repository location

Configure custom Python PIP and R CRAN package repository locations by using environment variables and configuration files to install packages in air-gapped environments. You can set custom default locations for Python and R package repositories. Custom repository locations are useful for air-gapped clusters that are isolated from public PIP and CRAN repositories on the internet.

Configuring Python PIP repositories

Custom PIP repositories can be set as default for all workloads at a site or project level. Site-level environment variables apply across the entire site, while project-level environment variables override site-level settings.

To configure custom PIP repositories, set the environment variables at the appropriate level:

  1. Site-level configuration:
    1. In the Cloudera console, click the Cloudera AI tile.

      The Cloudera AI Workbenches page displays.

    2. Click on the name of the workbench.

      The workbenches Home page displays.

    3. Go to Site Administration > Runtimes > Environment variables.

    4. Click Add Variable.

    5. Enter the following environment variables:

      PIP_INDEX_URL = [***PRIMARY INDEX URL***]
      PIP_EXTRA_INDEX_URL = [***ADDITIONAL INDEX URL***] (OPTIONAL)
  2. Project-level configuration:
    1. In the Cloudera console, click the Cloudera AI tile.

      The Cloudera AI Workbenches page displays.

    2. Click on the name of the workbench.

      The workbenches Home page displays.

    3. Select the applicable workbench.

      The workbenches Home page displays.

    4. Select the applicable Project.
    5. Click Project Settings from the left navigation menu.
    6. Select the Advanced tab and go to the Environment variables section.
    7. Select the icon to add an environment variable.

Configuring CRAN repository

Custom CRAN repositories must be set within an active session or as part of a custom engine. To set a new default URL for a CRAN repository, add the following line to the /home/cdsw/.Rprofile configuration file:

options(repos=structure(c(CRAN="<mirror URL>")))