On my CentOS 7 minimal server installation, I installed python-pip using YUM. However, the version it has installed is 8.1.2 for Python version 2.7 though the latest version is 22.3.1. Some of the packages needs a higher version of pip atleast above 9.0.1. When tried to upgrade using pip install –upgrade pip, the command fails Command "python setup.py egg_info" failed with error code 1.
Below is the complete error message. Help me to install higher version of PIP above 9.0.1 for python27
# pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad9 2c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz (2.1MB) 100% |████████████████████████████████| 2.1MB 196kB/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-KWpQ2a/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-KW pQ2a/pip/ You are using pip version 8.1.2, however version 22.3.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command.
How to manually install higher version of PIP on Python v2.7
Python pip is a package manager that is used to install and uninstall third-party packages that are not part of the Python standard library. Using pip you can install/uninstall/upgrade/downgrade any python library that is part of Python Package Index.
Step 1: You can download the script get-pip.py for your respective python version from the link. In my case get-pip.py is for python v2.7.
# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
Step 2: Run the get-pip.py script using python.
# python get-pip.py DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. Collecting pip<21.0 Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB) |████████████████████████████████| 1.5 MB 2.7 MB/s Collecting wheel Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB) Installing collected packages: pip, wheel Attempting uninstall: pip Found existing installation: pip 8.1.2 Uninstalling pip-8.1.2: Successfully uninstalled pip-8.1.2 Successfully installed pip-20.3.4 wheel-0.37.1
Step 3: Verify the pip version. You can notice the version of pip 20.3.4 installed when compared to the latest one. However, the latest one is not available for python v2.7
# pip -V pip 20.3.4 from /usr/lib/python2.7/site-packages/pip (python 2.7)
Thank you!!! solved!