Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Edit: the answer suggested in comment or other answers I found are main for linux or for default python installed using brew. The problem I am facing is on the python version installed using pyenv

when I am trying to install any package using pip I get this error message

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

I am using pyenv, pyenv-virtualenv and I am trying to install packages in a virtualenv with python 3.7.0. It was working fine few days back, I suspect updating my macOS to 10.14.6 caused this issue.

I couldn't find any working solution when googling or on StackOverflow. Can someone please help me to fix the issue

like image 389
Dev Khadka Avatar asked Dec 10 '19 12:12

Dev Khadka


People also ask

How do I fix ssl module is not available in Python?

The problem can be caused by DLLs in the Windows\System32 folder (e.g. libcrypto-1_1-x64. dll or libssl-1_1-x64. dll or others) placed there by other software. The fix was installing openSSL from https://slproweb.com/products/Win32OpenSSL.html which replaces the dlls by more recent versions.

What is ssl module in Python?

This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library.

Can't connect to https URL because the ssl module is not available RHEL?

The error states that the SSL python module is not available; meaning you either don't have an appropriate ssl lib installed (probably not since you state the system python can pip install fine), or the python you built from source or otherwise installed doesn't include the ssl module.

Can't connect to https URL because the ssl module is not available python3?

To Solve Caused by SSLError(“Can't connect to HTTPS URL because the SSL module is not available.”) Error If you are using anaconda then Then add this to PATH variable <path>\Anaconda3 <path>\Anaconda3\scripts <path>\Anaconda3\Library\bin Second Solution is Just copy this file libcrypto-1_1-x64. * libssl-1_1-x64.


1 Answers

The answers above was not working for me, any use of pip command was giving me the same error.

I finally solved the issue by re-installing the python3 using pyenv like below

pyenv install 3.7.0

# pyenv: /Users/devbhadurkhadka/.pyenv/versions/3.7.0 already exists
# continue with installation? (y/N) y

Thanks everyone for there answer

like image 124
Dev Khadka Avatar answered Oct 08 '22 00:10

Dev Khadka