Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can pip.conf specify two index-url at the same time?

Tags:

pip

I have tried using pip with index-url in pip.conf. However, i can not make sure that we can get all the necessary python library. So, i want to know if pip support specify more than one index-url in [global] section in pip.conf.

like image 852
andy Avatar asked Jun 17 '15 10:06

andy


People also ask

What is pip default index URL?

Base URL of the Python Package Index (default https://pypi.org/simple).

How does pip Conf work?

It contains configuration on how to access specific PyPI index servers when publishing a package. pip. conf on the other hand is only used by the pip tool, and pip never publishes packages, it downloads packages from them.

What is pip find links?

You're telling pip to find what you want to install on that page; and that page is in a predictable format as per PEP 503. The index will only list packages it has available. find-links is an array of locations to look for certain packages.


2 Answers

In your pip.conf, you will also have to add both of the index hosts as trusted, so would look something like this:

[global] index-url = http://download.zope.org/simple trusted-host = download.zope.org                pypi.org                secondary.extra.host extra-index-url= http://pypi.org/simple                  http://secondary.extra.host/simple 

In this example, you have a primary index and two extra index urls and all hosts are trusted.

If you don't specify the host as trusted, you will get the following error:

The repository located at secondary.extra.host is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host secondary.extra.host'.

Cheers!

like image 174
radtek Avatar answered Sep 20 '22 15:09

radtek


If you want more than one package index you have to use the --extra-index-url

From the pip man page:

   -i,--index-url <url>           Base URL of Python Package Index (default https://pypi.python.org/simple/).     --extra-index-url <url>           Extra URLs of package indexes to use in addition to --index-url. 

In pip.conf the name of settings must be put without --. From the documentation:

The names of the settings are derived from the long command line option, e.g. if you want to use a different package index (--index-url) and set the HTTP timeout (--default-timeout) to 60 seconds your config file would look like this:

[global] timeout = 60 index-url = http://download.zope.org/ppix 

So you can add in your pip.conf

extra-index-url = http://myserver.com/pip 
like image 25
Ortomala Lokni Avatar answered Sep 20 '22 15:09

Ortomala Lokni