Install or Download Python Package Using Nexus repositories
Steps to config Nexus pypi.org
To download packages from Nexus instead of Pypi , we need to config pip.ini ,
most of the time, its not only speed up build processes by caching commonly used dependencies but also help ensuring reproducible builds, since one only depends on their Nexus availability and not the public repositories.
pip
can also be configured to upload packages to Nexus, enabling the management of artifacts private to an organization.
Downloading/Installing packages from Nexus
In order to enable pip
to download packages from Nexus, it is necessary to edit pip
configuration file. This can be done on a per-user, per-virtualenv or system-wide basis. For the remainder of this section we will assume a per-user configuration. To use a different configuration, one should refer to pip
's documentation.
The per-user configuration file is located in different places on different OS’es:
- On Linux:
${HOME}/.config/pip/pip.conf
. - On Windows:
%APPDATA%\pip\pip.ini
.
Edit the corresponding file as follows:
[global]
index = https://nexus.example.com/repository/pypi-all/pypi
index-url = https://nexus.example.com/repository/pypi-all/simple
no-cache-dir = false
This will instruct pip
to search for and install packages from the pypi-all
group, previously configured in Nexus.