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

python2 error message #87

Closed
wants to merge 1 commit into from
Closed

Conversation

dtrodrigues
Copy link

@dtrodrigues dtrodrigues commented Jan 26, 2021

This shows a more informative error message when trying to use get-pip.py with Python 2. Something similar for Python 3.5 and older may also make sense.

Before:

$ python2 get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 24226, in <module>
    main()
  File "get-pip.py", line 199, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
  File "/var/folders/h4/tkxs1nyx46zd3zclshdprkv00000gn/T/tmpIcTK5C/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

After:

$ python2 get-pip.py
Python 2 is not supported with this version of get-pip.py. Please use https://bootstrap.pypa.io/2.7/get-pip.py

See also
pypa/pip#9500 (comment)
pypa/pip#9501
pypa/pip#9503
pypa/pip#9513
pypa/pip#9518
pypa/pip#9520
pypa/pip#9574
pypa/pip#9577
pypa/pip#9581
#82
#89
#92
#94
https://discuss.python.org/t/install-pip-on-ubuntu20-04-for-python2/6880
https://stackoverflow.com/questions/65866417/pip-install-failing-on-python2
https://stackoverflow.com/questions/65896334/python-pip-broken-wiith-sys-stderr-writeferror-exc
https://stackoverflow.com/questions/65932497/get-pip-py-returns-syntaxerror-invalid-syntax

@dtrodrigues
Copy link
Author

This looks to be a more narrow implementation of #25. I'm fine with either PR being incorporated, but it would be beneficial if the messaging was clearer than the status quo when somebody tries to use the wrong version of get-pip.py.

@mblufkin
Copy link

I recently encountered this error and had to switch to the versioned file (2.7), but this error message would have been helpful.

cclauss added a commit to cclauss/pyenv that referenced this pull request Jan 27, 2021
Fix pyenv to continue to support legacy Python builds despite the fact that `get-pip` has dropped support for Python 2 as discussed in pypa/get-pip#87
@cclauss
Copy link

cclauss commented Jan 27, 2021

This usage of an f-string breaks pyenv builds of Python 2.7, 3.4, and 3.5 until pyenv/pyenv#1793 (or similar) is landed and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants