Solution for pip install error [Python] [Mac]

I'm a python engineer and I'm a beginner, and I'll share what I'm having trouble with.

pip install error

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

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/

What to do when an error such as

I don't know the root cause at all, so for the time being, I searched for words that I saw for the first time, such as error sentences and ssl. There seem to be various solutions.

-environment- macOS 10.14.6 python 3.6.6 venv (virtual environment)

Cause

Perhaps pip / python is referencing the old openssl (1.0.2s)? As far as I can see from the information, the questioner's openssl is the latest version, so I think that a reference error has occurred.

Check if ssl can be used below.

py


import ssl

python


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/[username]/.pyenv/versions/3.7.0/lib/python3.7/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: dlopen(/Users/[username]/.pyenv/versions/3.7.0/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
  Referenced from: /Users/LO/.pyenv/versions/3.7.0/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so
  Reason: image not found

I got an error

Conclusion

sh


$ brew switch openssl 1.0.2s

Read this if you get SSL related errors with pip install! !! !! Only this.
ssl wasn't switched. When I solved it, the cause was simple and easy to understand.


There may be some interpretations of my own, but I hope it helps.

Recommended Posts

Solution for pip install error [Python] [Mac]
Install Python on Mac
Install Python 3 on Mac
Error with pip install
Install Python 3.4 on Mac
Install Python (for Windows)
[Python] for statement error
Install pygame on python3.4 on mac
Set Up for Mac (Python)
Python environment construction For Mac
Install pandas 0.14 on python3.4 [on Mac]
Python 3 series installation for mac
Install dlib for Python (Windows)
Install Python 2.7.9 and Python 3.4.x with pip.
All-round solution for permission error (permmision error)
Install Python on Windows + pip + virtualenv
pip install mysql-Error handling during python
Install Python 3.7 Anaconda on MAC, but Python 2
Install python3 on Mac (El Capitan)
Solution for scikit-learn (sklearn) fetch_mldata error
A pretty sloppy Python error solution
Python3 TensorFlow for Mac environment construction
Install confluent-kafka for Python on Ubuntu
Install Python framework django using pip
Steps to install python3 on mac
Proxy error when running "pip install"
Install python with mac vs code
[Python Windows] pip install with Python version
Solution for MacOS Catalina (10.15.2), python pip causes OpenSSL error in environment updated from old OS
install python
Dealing with PermissionError [Error 1] for pip install -U pip on macOS Sierra
# Solution when pip install gives an error when using Anaconda on Windows 10
Error and solution when installing python3 with homebrew on mac (catalina 10.15)
SSL certificate related with pip install? Error
In pip install clang: error: unknown argument:'-mno-fused-madd'
Creating amateur python environment settings (for MAC)
[Mac] Building a virtual environment for Python
Install Python package management tool pip (Windows)
scipy stumbles with pip install on python 2.7.8
Solution for run-time error in OpenVINO IEPlugin.load ()
Install python on xserver to use pip
mysqlclient installation error solution [Mac, Windows version]
Install Python 3.8, Pip 3.8 on EC2 (Amazon Linux 2)
Put MeCab binding for Python with pip on Windows, mac and Linux
2016-10-30 else for Python3> for:
Error when installing a module with Python pip
Solution for "Import Error: No module named requests"
python [for myself]
Prepare the development environment for Python on AWS Cloud9 (pip install & time change)
Change the default reference repository for pip install
"Temporary solution" when pip cannot be updated [Python]
sudo pip install
Building an environment for executing Python scripts (for mac)
Install Python locally
How to install Python for pharmaceutical company researchers
Python Error Handling
Install NAOqi python
Python: "[Errno 111] Connection refused" easy_install can't install pip
python on mac
Run pip install on MacOS Python 3.7 or later
Install Python Control