PIP: Install From Private PyPi Repository

By default pip installs packages from a public PyPi repository but can also be configured to install them from the private repositories, like Nexus or Artifactory.

In this note i will show how to configure pip to install packages from the private repositories.

I will also show how to define username and password in pip for the private repositories that require authentication and how to troubleshoot the SSL related issues.

Cool Tip: How to install specific version of a package using pip! Read More →

Pip Install From Private Repo

Install a package from the private PyPi repository:

$ pip install -i https://<repository-url> <package>
- or -
$ pip install -i https://<repository-url> -r requirements.txt

In case of the:

– or –
WARNING “The repository located at <repository-domain> is not a trusted or secure host and is being ignored.”

you can define a path to the CA bundle and install a package from the private PyPi repository as follows:

$ pip install --cert <path> \
              -i https://<repository-url> <package>

Or you can mark the <repository-domain> as a trusted host to ignore the SSL check:

$ pip install --trusted-host <repository-domain> \
              -i https://<repository-url> <package>

Connect to the private PyPi repository using the basic authentication:

$ pip install --trusted-host <repository-domain> \
              -i https://<user>:<pass>@<repository> <package>


$ pip install --trusted-host pypi.python.org \
              -i https://username:passw0rd@pypi.python.org/simple numpy

The private PyPi repository settings can also be defined in /etc/pip.conf, for example:

index-url = https://username:passw0rd@pypi.python.org/simple
trusted-host = pypi.python.org
#cert = /etc/pki/ca-trust/source/ca-bundle.crt
Was it useful? Share this post with the world!

2 Replies to “PIP: Install From Private PyPi Repository”

  1. Hi
    How would you do that securely, with the password and username not in a config file and not in the script that is getting the file for a test build?
    Can you pass the values in variables and use them from there?
    For instance, Jenkins will grab authentication info from a secrets vault and pass them in two variables in the environment of the build job.

  2. thanks for the explanation

Leave a Reply