question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pip trying to reach pypi.org eventhough index-url overriden

See original GitHub issue

Environment

  • 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:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Spriithycommented, Jan 20, 2020

Oh nice ! This fixes the issue so I’m closing it. Thanks for your help !

0reactions
xavfernandezcommented, Jan 20, 2020

@Spriithy You might want to try launching your pypiserver instances with --disable-fallback (to Disable redirect to real PyPI index for packages not found in the local index.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is pip trying to reach pypi.python.org when pip.conf ...
We were using an old version of pip, 1.5.6, which came out in May 2014. When we specified the index-url on the command-line...
Read more >
pip 1.0.1 - PyPI
The main website for pip is www.pip-installer.org. ... You are still able to override this location with the $PIP_LOG_FILE environment variable.
Read more >
User Guide - pip documentation v22.3.1
When installing packages from PyPI, pip requires internet access, ... Requirements files are used to override a dependency with a local patch that...
Read more >
Using Python's pip to Manage Your Projects' Dependencies
By default, pip uses PyPI to look for packages. But pip also gives you the option to define a custom package index. Using...
Read more >
PyPI packages in the Package Registry - GitLab Docs
If you want pip to access your private registry, add the --extra-index-url parameter along with the URL for your registry to your requirements.txt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found