FIX ERROR — Python2: PIP fails after upgrade

After upgrading PIP to CentOS 6, which still uses Python2.7, PIP for each command crashes with an error.

For example:

pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/88/d9/761f0b1e0551a3559afe4d34bd9bf68fc8de3292363b3775dda39b62ce84/pip-22.0.3.tar.gz (2.1MB)
    100% |████████████████████████████████| 2.1MB 544kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-snCNSf/pip/setup.py", line 7
        def read(rel_path: str) -> str:
                         ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-snCNSf/pip/
You are using pip version 8.1.2, however version 22.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

 

Reason:

PIP versions above 20.3 do not support Python2.7

Solution:

Install latest supported version

pip install --upgrade pip==20.3

 

Tagged: Tags

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments