Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip install gives misleading error message if no internet #3642

Open
cjerdonek opened this issue May 2, 2016 · 3 comments
Open

pip install gives misleading error message if no internet #3642

cjerdonek opened this issue May 2, 2016 · 3 comments
Labels
C: error messages Improving error messages C: network connectivity type: bug A confirmed bug or unintended behavior

Comments

@cjerdonek
Copy link
Member

  • Pip version: 8.1.1
  • Python version: 3.5.1
  • Operating System: OS X 10.11.4

Description:

I would like troubleshooting pip to be easier for the end-user when the cause is no internet connection.

If I run the following with no internet connection:

$ pip install --retries 0 MyPackage

then pip's stderr output looks like this--

  Could not find a version that satisfies the requirement MyPackage (from versions: )
No matching distribution found for MyPackage

Without the --retries argument, you will at least see connection errors prior to this.

In either case, it seems like pip's final error message should say something about its inability to connect. This would make diagnosis much easier. With the current message, it's not clear why no distributions were found.

I came across this behavior when encountering a similar issue in pip-tools. It's possible that pip-tools's issue is caused by pip's behavior in this regard.

@pganssle
Copy link
Member

pganssle commented Jul 23, 2018

@pradyunsg Moving some of the discussion from pypa/packaging-problems#177 to here (assuming this is the canonical issue for this):

There's some work that needs to be done to make it possible for pip to print a better error messages here. More generally, I think the "No matching distribution" message isn't very helpful in most cases for users and improving this is something worth looking into (#5003 is exactly this issue, #3642 is another example).

When thinking about it, I think one "good start" would be that rather than trying to pass all the state about what was rejected and why to the function that generates "Could not find a version that satsifies...", you could add logging into the code that accepts or rejects the versions found to indicate why it was rejected. Then the error message could change to:

Could not find a version for your configuration matching XXX
To see a complete log of accepted and rejected versions, run with the -vvv option.

Possibly this would be way too verbose, I'm not sure, but it might be worth looking into as an alternative to trying to explain why a given version was rejected in the error message.

@gutsytechster
Copy link
Contributor

Could this be resolved by #8133?

@uranusjr
Copy link
Member

I don’t think so since the main issue here is --retries 0 swallows the network exception. Changing the exception itself shouldn’t affect this, if I’m not mistaken.

@nlhkabu nlhkabu added C: error messages Improving error messages UX User experience related labels Jul 28, 2020
@nlhkabu nlhkabu removed this from the Print Better Error Messages milestone Jul 29, 2020
@pradyunsg pradyunsg added C: network connectivity C: error messages Improving error messages and removed UX User experience related C: error messages Improving error messages labels Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: error messages Improving error messages C: network connectivity type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

6 participants