"Temporary solution" when pip cannot be updated [Python]

Introduction

If you do pip install ~~, you may get a warning like "** It is recommended to update pip **" as shown below.

error_message1


WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Therefore, I updated pip with the command pip install -U pip (Reference). Then, the following TLS / SSL error will appear.

error_message2


umi-mori$ pip install -U pip
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/pip/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
Requirement already up-to-date: pip in /Users/masumimorishige/.pyenv/versions/3.6.5/lib/python3.6/site-packages (19.3.1)
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping

This error is an authentication error when connecting to a traditional network. Reinstall  Ľopenssl` and Create pip.conf Although it has been raised, there are many cases where it does not heal, so here we will introduce a "temporary solution".

How to solve

1. Download get-pip.py

The cause of the problem here is that you are trying to fetch pip from the internet. Therefore, first download get-pip.py from [this link].

You can hit the command curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py, but you may get an error, so in that case code from your browser Please get the python file directly.

2. Run get-pip.py

Running python3 get-pip.py will start the pip installation.

Reference link

Recommended Posts

"Temporary solution" when pip cannot be updated [Python]
Python note: When the pip command cannot be used
Solution when the image cannot be displayed with tkinter [python]
Python environment settings (virtualenv + pip cannot be done)
Investigation when import cannot be done with python
Solution when aws-cli cannot be executed on Mac virtual environment (after installing Python 3.8)
Causes when python version cannot be changed using pyenv
When USB cannot be formatted
When pydub cannot be installed
When will mmap (2) files be updated? (3)
When will mmap (2) files be updated? (2)
When will mmap (2) files be updated? (1)
[Python] Be careful when using print
One solution when numpy can be entered via pip but not via poetry
Solution for pip install error [Python] [Mac]
Python modules with "-(hyphen)" cannot be removed
A solution to the problem that the Python version in Conda cannot be changed
Correspondence memo when the direction key cannot be used on the python command line
Project cannot be created with Python3.5 (Windows) + django1.7.1
When Html cannot be output with Jupyter Notebook
When contour map cannot be drawn with APLpy
[Linux] When "| (pipe)" cannot be hit on CentOS7
What to do if pip cannot be installed
List packages that can be updated with pip
Solution when module'XXX' has no attribute'XXX' in Python
Updated to Python 2.7.9
Import libraries that cannot be pip installed with PyCharm
When Windows Subsystem for Linux (WSL) cannot be started
[Memorandum] Japanese keys cannot be used in python string.Template.substitute
[android] When AVD cannot be used with permission denied
list comprehension because operator.methodcaller cannot be used in python 2.5
Operators ++,-cannot be used in python (difference from php)
When import matplotlib.pyplot cannot be done in pyenv-virtualenv environment
What to do when "cannot import name xxx" [Python]
[Redash] Standard library cannot be used in python function
[Small story] How to install the module when pip cannot be used due to proxy etc.
Solution for MacOS Catalina (10.15.2), python pip causes OpenSSL error in environment updated from old OS