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:
SSLError “SSL: CERTIFICATE_VERIFY_FAILED”
– 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:firstname.lastname@example.org/simple numpy
The private PyPi repository settings can also be defined in
/etc/pip.conf, for example:
[global] index-url = https://username:email@example.com/simple trusted-host = pypi.python.org #cert = /etc/pki/ca-trust/source/ca-bundle.crt