-
Notifications
You must be signed in to change notification settings - Fork 3k
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 Error Messages on EnvironmentErrors when installing #5239
Conversation
Same question as always: Do we want tests? |
We always want tests :-) More seriously, a test that we don't say "use |
Checked against my testcase, it now prints:
But note that it still doesn't say the installation failed. I think it's important the output contains an explicit statement that the installation was not successful. |
if not show_error: | ||
message_parts.append( | ||
"To view error traceback, increase verbosity " | ||
"passing --verbose." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a native speaker, but "increase verbosity by passing --verbose"?
Not showing the original exception and asking the user to re-run with
I don't know where pip is installing the package, and the original exception is not shown either, so I have not idea which directory I should check the permissions. Contrast that with the last line when pip is trying to update its self-check state file:
That one is useful. |
@benoit-pierre I agree. Thanks for your input on this. :)
@pfmoore It's trivial to add it back but I think EPERM isn't the right error code here (based on here). None the less, we're still printing the error message so, we should be fine? As for tests, I'll take a look tomorrow. I've gone ahead and redone this entire logic. I've moved out the code into a separate function -- that should make testing it easier. It's also resulting in either the string representation of the error or the entire Traceback showing up in the terminal (not both). Further, it's also unconditionally mentioning that an error occurred. |
# If we won't show a traceback, tell the user how to get it. | ||
if not show_traceback: | ||
parts.append( | ||
"To view error traceback, increase verbosity by passing --verbose." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just show the traceback if we think it's needed, rather than asking the user to rerun? Although honestly I think this is too much hand holding - if there's not enough information in the displayed output, adding --verbose
is always the advice, so why call it out specifically here?
But I'd rather someone just make a decision on this - I don't want to debate wording to the point where we don't at least put some information in the user's hands.
…tall. This fixes various issues with the current logic and splits out the message generation into a separate unit-test-able function. Improvements: - Does not not-print any information in some cases - Mentions original error message, or entire traceback if verbose. - In case of permission/access errors, suggests the user to use --user and/or check permissions
I'll add tests in a subsequent PR. Happy to let this go in as is. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #5237