Home » pip install failing on python2

pip install failing on python2

To solve attempting to install pip However, pip install failing on Python2. So I’m going to explain all of the alternative answers here. Without further ado, let us begin this article with the goal of resolving this error. error follow below methods.


I’m attempting to install pip. However, get-pip.py throws a SyntaxError: improper syntax in Python. I installed pip using this command.

Traceback (most recent call last):
  File "get-pip.py", line 24226, in <module>

  File "get-pip.py", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
  File "/tmp/tmp2aZyDl/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
SyntaxError: invalid syntax

How to solve pip install failing on python2 ?

Pip 21.0 no longer supports Python 2 and 3.5. Python 3.6 or later is required for later versions. Pip for Python 2.7 can be downloaded from https://bootstrap.pypa.io/pip/2.7/

curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
python -m pip install --upgrade "pip < 21.0"

The final command is to upgrade to the most recent version that is supported. Pip 20.3.4 is currently supported for Python 2.7.

In Python 3.4

curl -O https://bootstrap.pypa.io/pip/3.4/get-pip.py
python get-pip.py
python -m pip install --upgrade "pip < 19.2"

In Python 3.5

curl -O https://bootstrap.pypa.io/pip/3.5/get-pip.py
python get-pip.py

Alternative to Solve pip install failing on python2

The correct get-pip.py file for python2 has been moved to

As a result of PIP dropping support for Python 2.7, you are experiencing the aforementioned issue, and the only solution is to downgrade the version of pip.

The below command works !

sudo easy_install pip==20.3.4

Hope the above solution works.

Also read :

ModuleNotFoundError: No module named ‘flask._compat’
The Python path in your debug configuration is invalid
WARNING: Ignoring invalid distribution site packages