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

Improve network error message #8641

Open
uranusjr opened this issue Jul 29, 2020 · 3 comments
Open

Improve network error message #8641

uranusjr opened this issue Jul 29, 2020 · 3 comments
Labels
C: error messages Improving error messages UX User experience related

Comments

@uranusjr
Copy link
Member

What's the problem this feature will solve?
pip automatically retries after hitting a network error, but the warning it emits is cryptic to users without experience on networking applications.

Recent examples: #7424 #8639.

The typical message a user gets would be something like:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after
connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection
object at 0x0000020EA6576108>, 'Connection to pypi.org timed out. (connect timeout=15)')': /some/url/

This is not too difficult to discern the error message as a client side networking issue with some Python and network experience. Less experienced users, however, cannot understand what to do to the cryptic output, and end up posting issues.

Describe the solution you'd like
Following the recent effort to format more user-friendly error messages, output a more descriptive message that says

  • What is likely happening.
  • What can the user do to the error.
  • Link to some documentation for further reading.

Additional context
I have not thought deep into how this should be implemented, to be honest. We should probably do two things:

  • Make the retry warning more descriptive by replacing the Retry(...) and ConnectTimeoutError(...) objects’ appearances (__repr__?) in it.
  • Wrap the network call, and output the user-friendly message described above when the retry limit is hit.
@uranusjr uranusjr added the C: error messages Improving error messages label Jul 29, 2020
@nlhkabu nlhkabu added the UX User experience related label Jul 29, 2020
@uranusjr
Copy link
Member Author

uranusjr commented Aug 9, 2020

Also including #6085 to this one, since they can be solved in a similar way, only the exception we want to catch is different.

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))
after connection broken by 'ProxyError('Cannot connect to proxy.',
NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001E6F70292E8>:
Failed to establish a new connection: [WinError 10061] No connection could be made because the target
machine actively refused it',))': /some/url/

This happens when the user has a proxy configuration problem.

@uranusjr
Copy link
Member Author

uranusjr commented Aug 9, 2020

I took a look at the implementation, and it seems like there’s no easy way to change the ugly Retrying message. The log is buried deeply in urllib3.connectionpool:HTTPConnectionPool.urlopen() without any viable override point (unless we patch the module directly).

I think the best we can do here is to output something more useful to the user when pip hits the max retry count.

@Rickiarty
Copy link

Check the following:

  1. whether you connected to Internet
  2. whether account and password that you use to log-in to network are both valid
  3. whether you're behind a proxy
    If you are behind a proxy, please contact your network administrator.

Maybe there are some possible reasons for the error message.

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 UX User experience related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants