Looks like they have removed support for Python 2.7 with the latest version of Pip.
https://lwn.net/Articles/843945/
If I pin the pip version to 20.3.4, it works fine.
Answer from Lakshmi Prabha Enjeti on Stack OverflowHow do I install pip for python 3.7.11 on CentOS 7 - Stack Overflow
upgrade pip and error on centOS7 - Stack Overflow
python - How do I install pip on CentOS? - Unix & Linux Stack Exchange
pip upgrade fails - tells me to upgrade pip
Looks like they have removed support for Python 2.7 with the latest version of Pip.
https://lwn.net/Articles/843945/
If I pin the pip version to 20.3.4, it works fine.
I have upgraded my pip to 20.3.4 version using this command. If you decited to stay on Python2.7 so you can upgrade your pip till 20.3.4
sudo python2.7 -m pip install --upgrade pip==20.3.4
Summarised from another site:
Core package repositories for CentOS 7 does not have python-pip. For that you need to enable an EPEL ("Extra Packages for Enterprise Linux") repository. You do that with
sudo yum install epel-release
After that, you should be able to install pip with
sudo yum install python-pip
Also possibly related:
- How to install pip in CentOS 7? (on StackOverflow, old)
- Recommended way to install pip(3) on centos7 (on StackOverflow, newer)
In particular, one answer there states that
Since Python 3.5,
pipis already bundled with the python distribution, so you can just runpython3.6 -m pipinstead ofpip.
alternate solution:
wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py
I usually just run the following commands to upgrade both pip2 (=pip by default) and pip3:
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
You must make sure that you upgrade the version (for Python 2 or 3), which you want to react on the command pip without number, last.
Also please note that this keeps the old packaged versions installed through apt-get or any other package manager, but adds new versions which have nothing to do with the system packages. The pip-installed packages will be preferred, but you should not remove the apt-get-installed ones either, because the package manager can't know that any pip version is installed otherwise.
I think the
pip install --upgrade pip
command does not work properly anymore. The correct command should be:
for Python 3:
python3 -m pip install --upgrade pipfor Python 2:
python2 -m pip install --upgrade pip
P.S. If you want to make sure your other Python packages are also up to date, follow the instructions here.