Skip to end of metadata
Go to start of metadata

You can customize your pip.conf to point to a custom pypi repository


Sometimes a pip user may want to install a python package from a repository other than http://pypi.python.org/simple/.

ONAP has a staging repository in nexus3 for example at https://nexus3.onap.org/repository/PyPi.staging/.


By default, when you "pip install" it pulls from the public pypi repo, but if you want to pull from a custom repo there are 3 ways to do so (listed in order of precedence):

  1. By passing a CLI flag to specify a custom index url

    pip install -i/--index-url <url> <package>
  2. By setting an environment variable

    export PIP_INDEX_URL=<url>
    pip install <package>
  3. By specifying in a custom pip.conf file

    [global]
    timeout = 60
    index-url = https://nexus3.onap.org/repository/PyPi/simple



Exhaustive documentation on pip configuration can be found here https://pip.pypa.io/en/stable/user_guide/#config-file

2 Comments

  1. Could you please clarify, on those Jenkins build VMs, what index URLs are already defined in the installed pip.conf with index-url and extra-index-url?

    Since we would like to do pip install with ONAP built pip packages that are not yet released (e.g. for testing), please include all Pypi.staging (for ONAP built but yet released), Pypi.release (for ONAP released), and Pypi (proxy for global pypi) in the pip.conf file on the ONAP Jenkins build VMs.   Or just Pipy.staging and Pypi.public because according to How to use PyPi JJB Templates, Pypi.public is the aggregate of Pypi.release and Pypi.

    Thanks.

  2. I try to run to install a package from the staging repo, but it fails. But I do find vnfsdk on that repo. Why? 

    $ pip install -i https://nexus3.onap.org/repository/PyPi.staging/ vnfsdk
    Collecting vnfsdk
    Could not find a version that satisfies the requirement vnfsdk (from versions: )
    No matching distribution found for vnfsdk