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

4

11

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

Landloper answered 10/12, 2019 at 12:35 Comment(4)
Try this:https://mcmap.net/q/82166/-quot-ssl-module-in-python-is-not-available-quot-when-installing-package-with-pip3Nursling
Does this answer your question? "SSL module in Python is not available" when installing package with pip3Nursling
no, that didn't work because i have installed the python 3.7.0 using pyenv. pip is working with system version of pythonLandloper
Yes, re-installing python helped, plz see my answer belowLandloper
L
30

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

Landloper answered 11/12, 2019 at 6:18 Comment(2)
That worked for me too, although in my case it was Python 3.10.3. pyenv found the openssl I'd installed with homebrew and did whatever it needed to do to integrate it, indicated by this line that was displayed during the pyenv operation: "python-build: use [email protected] from homebrew"Dronski
Already that libssl-dev and openssl installed. This was the solution for me as well.Proprietress
I
3

Install OpenSSL, this will fix the issue.

And if you are using Anaconda then prefer Ananconda prompt for the installation of the packages.

Ingathering answered 21/6, 2020 at 17:43 Comment(0)
D
0

I think you in to upgrade your pip library using below command.

sudo pip3 install --upgrade

Then after use below command to install SSL module of python3.x

sudo pip3 install ssl

Domash answered 10/12, 2019 at 12:44 Comment(1)
Try to use pip3 install pyopenssl for python3.x versions and for 2.x use pip install pyopensslDomash
S
0

Solution: install some packages that helps with ssl

sudo apt install build-essential pkg-config zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-dev
Superfine answered 5/10, 2023 at 8:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.