[PYTHON] When I try to upgrade pip, I get an infinite loop after failing to upgrade

environment

OS: Ubuntu16.04(Xenial Xerus)

Status

When I try to use pip3, I get the error "The version is old, please upgrade". The error says that you should use "pip install --install pip", but even if you type this command, After installing the old version, I get an error saying "Please upgrade".

In short, I'm trying to upgrade with pip, but I can't upgrade because it's an older version Is in a state where a mysterious error appears.

Specific error content

You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command

Dealing with errors

  1. Follow the instructions obediently.
pip install --upgrade pip
→ For some reason pip8.1.1 is installed and I get the same error
  1. Try it with pip3
pip3 install -U pip
→ [Error]
  Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr

Did something go wrong because you couldn't uninstall the existing pip?

  1. Try uninstalling pip itself
sudo apt-get remove python-pip
sudo apt-get remove python3-pip

↓ I tried "pip --version" and "pip3 --version", but the version of 8.1.1 is output.

  1. Try uninstalling with another method
sudo python -m pip uninstall pip setuptools
sudo apt-get remove python3-pip

pip3 --version
> pip 9.0.1
pip --version
> pip 9.0.1

I was able to do it this time for some reason. Moreover, when I thought that it would only be deleted, the version I was looking for was installed as 9.0.1. This completes the version upgrade of pip.

If the version upgrade was not completed, an error prompting for the version upgrade would continue to appear, so pip itself could not be used. I'm glad I was able to upgrade the version safely.

Recommended Posts

When I try to upgrade pip, I get an infinite loop after failing to upgrade
I get an error when trying to install maec 4.0.1.0 with pip
When I try to run the pip command after updating pip, I get "No such file or directory"
I get an error when I try to raise Python to 3 series using pyenv on Catalina
[Solution] When I try to connect to CloudSQL with GAE, I get an ImportError only when using dev_appserver.
[Note] Items to check when an infinite loop occurs in pyenv
When I try to use pip, SSL module is not available.
When I get an error with PyInstaller
I couldn't get out after upgrading pip
Workaround if you get an error when trying to install PySide with pip
I tried to get an image by scraping
When I try to import pandas on macOS I get the error No module named'_bz2'
When I try to install mysqlclient with Django, I get error: command'gcc' failed with exit status 1.
I tried to get an AMI using AWS Lambda
I get an error when trying meinheld + WebSocket + mongodb
What to do if you get an Undefined error when trying to use pip with pyenv
When I try to push with heroku, it doesn't work
I get [Error 2055] when trying to connect to MySQL on Heroku
When I try to make Apache SSL, it doesn't start.
A memorandum when I tried to get it automatically with selenium
When I get an error with Pylint in Atom on Windows
What to do when you get "I can't see the site !!!!"