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 --upgrade can return zero even when it failed #11463

Open
1 task done
wimglenn opened this issue Sep 19, 2022 · 3 comments
Open
1 task done

pip install --upgrade can return zero even when it failed #11463

wimglenn opened this issue Sep 19, 2022 · 3 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior

Comments

@wimglenn
Copy link
Contributor

wimglenn commented Sep 19, 2022

Description

pip install --upgrade commands which fail to reach the index should return nonzero.

I expect this to be nonzero so that e.g. a CI script will crash out when the pip install --upgrade line is not successful.

Expected behavior

pip install --upgrade <something> should return non-zero when the package could not be upgrade due to errors

pip version

current

Python version

3.10

OS

rhel7

How to Reproduce

  • make sure package XYZ is already installed
  • intentionally break SSL (for example by renaming/moving the _ssl .so file away)
  • pip install --upgrade XYZ

Output

[builder@6c720825086a ~]$ python3 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Requirement already satisfied: pip in ./.local/lib/python3.10/site-packages (22.2.1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
[builder@6c720825086a ~]$ echo $?
0

Code of Conduct

@wimglenn wimglenn added S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior labels Sep 19, 2022
@zhuofeng6
Copy link

#8473

@uranusjr
Copy link
Member

Looks like the actual complaint (for lack of a better word?) is that not finding any distributions should probably result in a non-zero return code.

@wimglenn
Copy link
Contributor Author

wimglenn commented Sep 26, 2022

That's right. We had a script which went on to attempt to do things that it shouldn't have done, because of an outdated pip & setuptools. A non-zero return code would have stopped it in its tracks earlier. Although there is no chance to fix this for older releases, where it matters most, it's probably still worth fixing in main (because it's the same problem still when the target package to be upgraded is not pip itself).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: bug A confirmed bug or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants