close

How to setup pip to download from mirror repository by default?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to setup pip to download from mirror repository by default in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to setup pip to download from mirror repository by default?

  1. How to setup pip to download from mirror repository by default?

    Use pip3 config list -v to get list of locations where your pip.conf is located. Then go to one of the location(I prefer user) and add your URL. The file should look like this, if empty then add the lines.

  2. setup pip to download from mirror repository by default

    Use pip3 config list -v to get list of locations where your pip.conf is located. Then go to one of the location(I prefer user) and add your URL. The file should look like this, if empty then add the lines.

Method 1

using pip config, on user or global level. I have /etc/pip.conf configured like this:

[global]
index=https://my-company/nexus/repository/pypi-group/pypi
index-url=https://my-company/nexus/repository/pypi-group/simple
trusted-host=my-company

but you can configure this using pip config on user or global level, something like:

pip config --user set global.index https://my-company/nexus/repository/pypi-group/pypi
pip config --user set global.index-url https://my-company/nexus/repository/pypi-group/simple
pip config --user set global.trusted-host my-company

Method 2

Use pip3 config list -v to get list of locations where your pip.conf is located. Then go to one of the location(I prefer user) and add your URL. The file should look like this, if empty then add the lines.

[global]
index-url=https://pypi.org/simple
extra-index-url=<your_url>

In case if you want pip to look into your URL first then switch the places of url on above options.

[global]
index-url=<your_url>
extra-index-url=https://pypi.org/simple

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read