pip trying to reach pypi.org eventhough index-url overriden
See original GitHub issueEnvironment
- pip version: 19.3.1
- Python version: 3.7.3
- OS: debian Buster
The machine is setup in a secure / isolated network with no internet connection. I have two machines supplying a PyPi server (namely hereafter index0
and index1
).
My /etc/pip.conf
looks like this :
[global]
index = http://index0:8080
index-url = http://index0:8080/simple
extra-index = http://index1:8080
extra-index-url = http://index1:8080/simple
trusted-host = index0
index1
timeout = 100
Description
When installing a package present on index0
’s PyPi server, everything works fine. But when installing a package that isn’t present on index0
but is on index1
, pip tries to contact https://pypi.org/simple/<package_name>
. This results in pip retrying 5 times to request this URL in vain eventhough I have my pip.conf
overriding the index URLs and where to search for packages. This is extremely similar to #6799 but is not fixed by upgrading pip or python or system whatsoever.
Expected behavior
Pip would skip index0 upon failure and directly request index1.
How to Reproduce
/
Output
I am not able to copy / paste the output of the commands directly since it happens on a network-isolated machine. However, output is extremely similar to that of #6799 and contains :
$ pip install --verbose <package>
[creating some temp dirs]
Looking in indexes: http://index0:8080/simple, http://index1:8080/simple
* http://index0:8080/simple/<package>
* http://index1:8080/simple/<package>
Getting page http://index0:8080/simple/<package>
Found index url http://index0:8080/simple
Starting new HTTP connection (1): index0:8080
http://index0:8080 "GET /simple/<package>/ HTTP/1.1" 303 0
Looking up "https://pypi.org/simple/<package>" in the cache
And then a bunch of pointless retries on this request before successfully contacting index1 and installing the package as expected.
This is pretty annoying I must admit. It would be less of a pain would I be able to override the default retry count in the pip configuration but I haven’t been able to find such parameter anywhere.
Thanks in advance for the quick reply
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Oh nice ! This fixes the issue so I’m closing it. Thanks for your help !
@Spriithy You might want to try launching your
pypiserver
instances with--disable-fallback
(toDisable redirect to real PyPI index for packages not found in the local index.
)