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

44

485

I am using Python 3.6. When I try to install "modules" using pip3, I face this issue:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
Strode answered 30/8, 2017 at 7:31 Comment(10)
operating system?Radarman
if it is os x: #35281456Radarman
Operating system is oracle linux 7.xStrode
Do you installed pip from package manager? If you installed compiling, first install libssl-dev or install ssl from pip pip install ssl #41098752Radarman
@Radarman pip doesn't work becuse of ssl and you ask to install ssl, with pip :)Purcell
Any solution not requiring to recompile or reinstall python?Bielefeld
solution : https://mcmap.net/q/81000/-building-python-3-7-1-ssl-module-failedCookie
Possible duplicate of Building Python 3.7.1 - SSL module failedCookie
OSX brew reinstall python worked for meEmie
Any idea how do we fix this issue in case of Amazon Linux, which supports only yum commands for installation...?Comintern
M
366

For Windows 10 if you want use pip in normal cmd, not only in Anaconda prompt. you need add 3 environment paths. like the followings:

D:\Anaconda3 
D:\Anaconda3\Scripts
D:\Anaconda3\Library\bin 

most people only add D:\Anaconda3\Scripts

Microelement answered 27/2, 2019 at 3:4 Comment(14)
Thanks, I've added D:\Anaconda3\Library\bin and it works, by the way the libssl-1_1-x64.dll is in that folder. (win10x64, python 3.7)Chichihaerh
when you add those three in your path close the cmd go back to it and try again it should work.Debauched
What do yo u mean by environment paths? do you mean the PATH environemnt variable? plus I do not have those folders in my D drive, are they supposed to be created when I install Anaconda?Gare
An also for windows 8.1Carnassial
This does NOT work if one is not using Anaconda. I have experienced this issue with OSGeo4W64 and QGIS 3.10.2 installations. Adding what I gather are the correct paths to the PATH variable does not fix the issue (ex: C:\Program Files\QGIS 3.10\apps\Python37\Scripts).Cadmus
Note the path to Anaconda on your machine may be different, e.g. C:\Users\myUsername\Anaconda3Sconce
Setting env paths: #9546824Smiga
Thanks so much! Solved on Win10 after a frustrating search.Dielle
@Cadmus I fixed this by installing the 32 bit version of OSGeo4WMonosepalous
What if you don't have a D:/ disk?Eudemonia
Worked for me using miniconda on Win 10Zeta
Anaconda is a default base environment. If one is trying to install modules in a virtual environment, modify activate or activate.bat (on Windows) and include the 3 directories when resetting %PATH%.Albric
No! PATH appears ok but it's not the right answer. After adding your PATH and pip works then, it installed packages to an uncertain place!! Keep on using conda prompt is the correct answer.Fecteau
I was using Miniconda3 installed for the current user on Windows 10, and these directories are already on the PATH, so this didn't work. What worked for me was the answer from @datchung to copy the libcrypto and libsll DLLs to the DLLs folder.Allanallana
H
254

MAC OS

I had the same problem on Mac OS(Mojave) and solved the problem as mentioned on this link - Openssl issue.

  1. If you do not have Homebrew or don't know what is Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Or if you already have Homebrew installed:
brew update && brew upgrade
brew uninstall --ignore-dependencies openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Update: Keep in mind, that I had to use --ignore-dependencies flag, because other packages installed that depend on OpenSSL.

Additional if the problem is caused after using pyenv, you can fix it by using:

brew reinstall python
Hoes answered 11/12, 2019 at 6:39 Comment(20)
After installing another Python version , pip was broken. this solution helped me repair.Seljuk
why is github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb also added as a dependency? :) I think it should be removed as it is totally unrelated and potentially unsecureRefugiorefulgence
I understand that it could be a security risk but all over users have asked to use the package over the official package link - github.com/kelaberetiv/TagUI/issues/635Hoes
That solved my problem! Don't forget to echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profilePliant
This solved my problem! Wondering what's that openssl package is though?Readytowear
@Hoes I am actually asking about the openssl package in the github :p. More worried about that. Is this issue quite recent? I never had this issue up till now. Seems like openssl package in brew is broken somehow. Still, much thanks for this solution!Readytowear
I think it is a combination of things that is breaking openssl. Something to do with multiple python versions and openssl. Else it works fine. For me it was more specifically pyenv that broke things. It installs such a lot of shitload.Hoes
@Hoes Now that you mention it. I think I installed some packages using brew as well before this broke. It was gpg.Readytowear
After upgrading from Mojave to Catalina, I hit this. I only needed brew update && brew upgrade for it to work again. Thanks for the advice!Locality
{code}brew update && brew upgrade{code} fixed it for me, though it failed to install python3 in /usr/loca/lib/bin . This was fixed with {code}export PATH="/usr/local/opt/[email protected]/bin:$PATH"; export LDFLAGS="-L/usr/local/opt/[email protected]/lib"{code}Out
Additionally, if you are in a virtualenv, deactivate the virtualenv, create a new venv and then proceed.Aquavit
Hi! I am using asdf on Mac. Had Python version 3.6.8. When I installed, using asdf, python 3.8.2, issue was gone.Pedropedrotti
No criticizing your answer (more the situation in general), but needing to use brew upgrade (which will upgrade all my dependencies globally, which in turn can make other things break) is really messed up to solve a problem I'm having for a particular project.Delainedelainey
I am on Mac OS Mojave 10.14.6. Everything was working fine until last night and this morning started receiving the error. This solution worked for me ! Thanks much !Samara
For me simply brew update && brew upgrade fixed the issue on Mac OS X.Antler
great! it finally worked after "brew reinstall python". Thanks !Foregoing
brew update && brew upgrade works indeed; but if you're like me, don't forget to source ~/.bashshrc or source ~/.zshrcConjurer
For me brew reinstall python resulted in [email protected] 3.7.3 is already installed So I upgraded as suggested: brew upgrade [email protected] It workedSodomy
This had been driving me crazy, because I usually just write code in Sublime or some other text editor. I chose to finally give PyCharm a try and this was killing me! The brew reinstall pythonOsteoclast
DONT USE THE SECOND SCRIPT! IT INCLUDES brew install github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb WHICH IS NOT JUSTIFIED AND SUSPECIOUS!!Isidraisidro
D
118

For Debian users, the following may be of use:

sudo apt install libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.6 libgdm-dev libdb4o-cil-dev libpcap-dev

Then cd to the folder with the Python 3.X library source code and run:

./configure
make
sudo make install
Dictatorship answered 6/4, 2018 at 15:19 Comment(14)
@MehmetKurtipek, I edited the answer to clarify a step. If this still does not help, please clarify your problemDictatorship
turned out that Python3.7 has nice problems along with Ubuntu 14.04 and older. The minimum required SSL package for Python3.7 is not compatible with old ubuntus. So thanks for editing :)Kamala
@MehmetKurtipek My server is 1404. So what is the latest version of python that don't have this problem. I have python 3.7.4 have the same problem...Valine
@MehmetKurtipek Have you solve the problem without upgrading the system? I am also working on 14.04Valine
using mint19 and python 3.8, this fixed my problemHunley
Where is the folder with the python library source code? I tried the following but could not run ./configure in any of them. /usr/local/lib/python39.zip /usr/local/lib/python3.9 /usr/local/lib/python3.9/lib-dynload /home/user/.local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packagesBookbindery
Thx, it's really helpful!Twentyfourmo
Thanks, this helped me. I gave you an upvote, but I am wondering why you put each install on a separate line. The separate lines make reading clear, but copying and pasting is more arduous. Have you considered making it a one-liner?Schwaben
This is great thank you! May I recommend adding libffi<X> to this list. After running the sudo apt install ..., I still needed to install libffi7.Extractive
I only needed to install libssl-dev (not sure if the other packages were already installed or not), but otherwise this worked for me.Guria
This one works for me!Village
this one works for me. my environment: python 3.11, ubuntu 20.04 :)Logy
I ran into the same problem, trying to install Python 3.11.1 on Debian-based Raspberry Pi OS. The ssl module in Python >= 3.10 requires OpenSSL 1.1.1 or higher (docs.python.org/3/library/ssl.html#module-ssl). The PI was still running on Stretch (with OpenSSL 1.1.0). After updating OpenSSL I had to run ./configure with the flags --with-openssl=/path/to/openssl --with-openssl-rpath=auto.Herrin
All the answers failed. I debugged using python and then import ssl and saw that it failed loading _ssl. Then I transferred /usr/local/lib/python3.11/lib-dynload/_ssl.cpython-311-aarch64-linux-gnu.so from a server that already had a working Python3.11, and it worked like a charm. PS: I used find / -type f -name '_ssl*' 2>/dev/null to look for the right file...Indescribable
B
91

I'm using Windows 10 and installed Miniconda 3 with Python 3.7.

I solved this error by following this https://github.com/conda/conda/issues/8273

Specifically, I copied the following files from C:\Users\<user>\Miniconda3\Library\bin to C:\Users\<user>\Miniconda3\DLLs:

  • libcrypto-1_1-x64.dll
  • libcrypto-1_1-x64.pdb
  • libssl-1_1-x64.dll
  • libssl-1_1-x64.pdb

If you work in an environment, it will be from C:\Users\<user>\Miniconda3\envs\<name>\Library\bin to C:\Users\<user>\Miniconda3\envs\<name>\DLLs:

Bornu answered 8/6, 2020 at 14:47 Comment(10)
This works; thanks ... Windows 10 (Anaconda) on two machines.Shandy
This worked for me too. I have Anaconda installed not Miniconda but I was not using it or so I thought. I set up a new project from scratch in vscode with a .venv and was unable to install packages until I did this.Purree
AWESOME!!! It worked for me!!! thank you so much, bro ;)Danielson
Thanks, its work for me on SQL Server Enviromment and Windows 11. Use the same login copping files from C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin to C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLsViradis
This worked for me, same as @Viradis except on Win10. SQL Server Machine Learning Tools (sp_execute_external_script) doesn't provide any other way to install packages except pip. Sounds like there will be a non-pip tool in SQL Server 2022.Pearl
This worked also for Anaconda! Thank youElectroencephalograph
Can confirm this worked for me, although I only copied the *.dll filesAscendancy
Just to add to this. In case you're using a conda env, then the path are C:\Users\MyUser\Miniconda3\envs\<NAME_OF_YOUR_ENV>\Library\bin to C:\Users\MyUser\Miniconda3\envs\<NAME_OF_YOUR_ENV>\DLLsHuntingdonshire
Works in Windows 7 tooInflammable
This did not work but @Huntingdonshire comment did work. That comment is essentialEpizootic
T
61

For centos 7:

Install openssl:

sudo yum install openssl-devel

now goto python directory were we extracted the python tar,

run below commands

sudo ./configure
sudo make
sudo make install

This will fix the problem in centos...

Tournai answered 28/7, 2019 at 10:57 Comment(13)
Not working for Python 3.8. Any other possible solution?Feeney
@Feeney try reinstalling python 3 it's been a while I used unixTournai
Worked for me for python 3.8.1 !Hae
I see "Package 1:openssl-devel-1.0.2k-25.el7_9.x86_64 already installed and latest version", so this was available when I built python 3.10.4Esbensen
This worked for me for Python3.8Moncton
Not working for Python3.10.6 on RedHat 7.9.Kiona
@hafiz031, did you figure it out?Bloodstone
@AndreMarin my finding is: when your operating system's version is too old than the python's version you are trying to install, then this problem occurs. I tried installing Python3.10.6 in RedHat 9 which worked.Kiona
Not working for Python3.10.6 on Centos 7Krissy
Any fixes available now? i dont have the option to change my centos7 into centos stream altogether! @Mr.PanchoBlunk
This indeed worked for me. Thanks!Horning
This answer may not fix our issue, but the direction is right. this issue is caused by lack of dependencies during make and install Python source code. Solution: yum install yum-utils, yum-builddep python3. then ./configure, make && make install is the right way to install Python from source code.Murton
Also see here: https://mcmap.net/q/81001/-how-to-fix-quot-ssl-module-in-python-is-not-available-quot-in-centos.Mosier
M
37

For future Oracle Linux users trying to solve this, below is what worked for me. First install missing libs:

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel 
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

Then cd to your Python3.X library and run:

make
make install 
Mendelssohn answered 15/3, 2018 at 10:18 Comment(7)
This answer has addressed the problem well on my CentOS 7.Arching
What are these libraries? Why are they required?Bandanna
Doing a secure connection over the internet requires this - for instance when you run 'pip install'Mendelssohn
@MohitMotwani - fuhgeddaboudit... urbandictionary.com/define.php?term=fuhgeddabouditRiane
Indeed, not everybody wants dgdbm or tk-devel libraries. Especially for servers.Pentomic
Solved issue for pip3 upon python 3.6.12 installation in image amazonlinux:2.0.20220912.1Armorer
See here: https://mcmap.net/q/81001/-how-to-fix-quot-ssl-module-in-python-is-not-available-quot-in-centos and here: https://mcmap.net/q/81002/-how-to-succesfully-compile-python-3-xMosier
E
32

macOS, pyenv

In case of your python being an pyenv installed one, where pyenv is installed with homebrew on macOS, there might me a newer version available which fixes this:

$ brew update && brew upgrade pyenv

Then reinstalling the python version:

$ pyenv install 3.7.2
pyenv: /Users/luckydonald/.pyenv/versions/3.7.2 already exists
continue with installation? (y/N) 

Note, it is a bit dirty to overwrite the existing python install like that, but in my case it did work out. Probably cleaner to delete it and then recreate it properly.

Erosive answered 25/4, 2020 at 17:17 Comment(4)
saved the day !Bollworm
Thank youuuuu. This kind of convoluted crap I just spent 3 hours on is why I hate Python.Disruptive
Try upgrading npm packages for fun, and you'll love that python does so many things right.Erosive
@Erosive openssl@1 is deprecated. I removed it with brew. I didn't realize so many brew packages were linked to it. I corrected those by removing and reinstalling. I didn't realize some python packages were also linked to that same brew installed openssl@1 package. Your advice solved my issue.Berry
R
20

Worked for me.

sudo apt-get install libssl-dev

Use this to enable ssl for pip. Let me know if someone encounters issues.

Ruyle answered 30/10, 2019 at 6:53 Comment(1)
Didn't help in CentOS 7 for Python 3,11Brisling
R
19

For Windows 10,windows 7 If pip install is not working on CMD prompt, run it using Anaconda prompt - it works.

https://github.com/pypa/virtualenv/issues/1139

Reject answered 31/1, 2019 at 4:44 Comment(3)
I know the right answer, if you want use pip in normal cmd, not Anaconda prompt you need add 3 environment paths: like these: D:\Anaconda3; D:\Anaconda3\Scripts; D:\Anaconda3\Library\bin now only Scripts !Kathrynkathryne
@Microelement No! PATH appears ok but it's not the right answer. After adding your PATH and pip works then, it installed packages to an uncertain place!! Keep on using conda prompt is the correct answer.Fecteau
Did not work for me ...Carnassial
L
11

Encountered this issue while installing python 3.8 from source on ubuntu. The steps needed to install it successfully alongside the default python 3.7 are summarised below :

sudo apt -y install libssl-dev zlib1g-dev build-essential

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -xf Python-3.8.0.tgz
cd Python-3.8.0/

./configure --enable-optimizations
make
sudo make altinstall

The install instruction for zlib1g-dev and build-essential is redundant, as ubuntu desktop already has these, but was necessary for some of Amazon's EC2 instances. python 3.8.0 is the current release just now, but should be replaced with the latest available.

These instructions are best for keeping python 3.7 as the default for python3, and running python 3.8 in a virtual environment.

Laevorotatory answered 7/11, 2019 at 5:22 Comment(1)
Aside from an error with the make step (I'm not sure that's even needed), this answer solved my problem of how to get pip for Python 3.11 working on a Raspberry Pi. Thanks.Heartthrob
M
8

Similar to the above solution reinstall the python version with pyenv.

Somehow, I upgraded my openssl which broke the pyenv version python.

pyenv install 3.6.8
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
...

The first line says it relies on the homebrew openssl.

Magnetics answered 9/5, 2020 at 22:13 Comment(1)
Same here, my python3.10 just became 3.6 .Arndt
B
7

In my case, I reinstalled Python. It solved the problem.

brew reinstall python
Bitt answered 11/7, 2020 at 12:4 Comment(0)
B
6

For OpenSUSE in the same manner, but a few changes of listed above packages:

zypper install zlib-devel libopenssl-devel ncurses-devel sqlite3-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel

Then cd to Python sources dir and

make
make install

or

make
make altinstall

And perhaps

ln -s /usr/local/lib64/python3.6/lib-dynload/ /usr/local/lib/python3.6/lib-dynload

should be executed for OpenSUSE users. See Python 3.7 install not working on openSUSE Leap 42.3

Burrussburry answered 19/11, 2018 at 3:6 Comment(0)
P
5

Just try installing through Anaconda prompt

Puentes answered 10/7, 2019 at 6:25 Comment(0)
E
5

I ran into this issue with Visual Studio Code installing pylint from the VS Code prompt. I was able to overcome the issue by opening the Anaconda installation directory and running

pip install pylint

Then VS Code was happy, but that did not fix the issue as running

& C:/Users/happy/Anaconda3/python.exe -m pip install -U pylint

pretty much gave the same error so it seems that VS Code is unable to access the python modules.

Note that VS Code picks up the first python env it see when installed, the bottom left of the screen indicates which env is being used. Clicking on that area allows to set the environment. So even if you ran the pip install for an environment VS Code could be looking at a different one.

Best approach was to make sure that VS code had the correct python environment selected and that same environment is in the system PATH (under System Properties --> Advanced --> Environmental Variables)

Under the Path Variable, Edit and browse to the specific Anaconda directory that you want VSCode to use and add to PATH, I needed to Add the following:

C:\Users\happy\Anaconda3\
C:\Users\happy\Anaconda3\Scripts\
C:\Users\happy\Anaconda3\Library\bin\
C:\Users\happy\Anaconda3\Library\mingw-w64\bin\

Your Anaconda installation directory may differ. One note is that Windows does not have the PATH variable take effect until you restart the terminal. In this case close and re-op VS code. If using a Terminal or PS Shell then close and reopen and check Path to make sure it is included.

Earthlight answered 8/1, 2020 at 0:40 Comment(0)
P
5

The problem probably comes from your installed openssl package version. That was the case for me and I fixed this issue just upgrading it. I'm on Mac OS, using brew :

brew upgrade openssl

If you installed python with brew, this should directly fix the issue with it, as python is dependent on openssl

Photodrama answered 1/4, 2020 at 21:22 Comment(0)
V
5

Newest Python 3.8.4 or higher should able to support https protocol out of box. If you still have old python installation on your pc - either download & install python3 manually, or using Chocolatey:

If you don't have Chocolatey, install it - from here: https://chocolatey.org/docs/installation

You can just copy paste one command line liner and execute it from command prompt with elevated priviledges.

choco install python3

if you don't have python3 installed, or you you have it installed - then:

choco upgrade python3

Notice also that you can use also anaconda distribution, as it has built-in python with https support, but this rather ancient instructions, no need to follow them anymore.

Install anaconda, using command line:

choco install anaconda3

Set environment variables:

set PATH=C:\tools\Anaconda3\Scripts;C:\tools\Anaconda3;C:\tools\Anaconda3\Library\bin;%PATH%

and then run command which failed. In my case it was:

pip install conan

Anaconda uses separate python installation, and pip is also anaconda specific.

Verdi answered 6/5, 2020 at 6:53 Comment(0)
T
5

Worked for me.

pkg install openssl

Use this to enable ssl.

Tolerance answered 7/3, 2022 at 23:6 Comment(1)
Worked for me too (tried to install Django via Termux). Android 8. Thanks.Dragoon
R
4

If someone is using Arch Linux OS, I solved the TLS/SSL problem by running this:

sudo pacman -S openssl

Then I could use pip to install the package I needed:

pip install openpyxl
Ridgeling answered 18/3, 2019 at 3:40 Comment(1)
Update for 2022: the openssl package is 3.0 and python seems to be looking for the 1.x module. I was able to fix with: sudo pacman -S openssl-1.1Jephum
H
4

Go to Anaconda prompt and type (if you have python 3.x installed on your engine) :

py -m pip install pymysql 

i was having the same issue and this solved my problem. later after doing this you can import pymysql in power shell or any other prompt.

Hutment answered 11/6, 2019 at 10:29 Comment(0)
B
3

As Tokci said, it also works for Windows 7.

"Go with the mouse to the Windows Icon (lower left) and start typing "Anaconda". There should show up some matching entries. Select "Anaconda Prompt". A new command window, named "Anaconda Prompt" will open."

Then pip works.

The following also helped to import xgboost: https://www.youtube.com/watch?v=05djBSOs1FA

Brooklynese answered 7/2, 2019 at 7:34 Comment(2)
Looking for the linux equivalent ... but anyway, why would this work and using pip from the command line won't? this only makes sense if you already rebuilt anaconda's python with SSL beforehand at some point.Bielefeld
I have no idea why but what you say sounds reasonableBrooklynese
N
2

The issue is due to OpenSSL package is missing on your PC.

If pip install openpyxl also gives error.

you can fix this by installing OpenSSL(Win64 OpenSSL v1.1.1g) from below site :

slproweb.com/products/Win32OpenSSL.html

Restart the IDE you are using, for changes to be in effect.

Nut answered 3/6, 2020 at 14:11 Comment(0)
E
2

In Windows 10 SQL Server 19 the solution is known.

Copy the following files:

  • libssl-1_1-x64.dll
  • libcrypto-1_1-x64.dll

from the folder

C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin

to the folder

C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs

Then open a new DOS command shell prompt.

From https://learn.microsoft.com/en-us/sql/machine-learning/troubleshooting/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15#7-unable-to-install-python-packages-using-pip-after-installing-sql-server-2019-on-windows

Equilibrist answered 20/2, 2021 at 5:48 Comment(0)
L
2

This issue occurs when we compile python from source without installing some packages that helps with ssl. Here is how to fix this in a Debian based Linux system.

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
./configure --enable-optimizations
make -j 4 
sudo make altinstall

Note that -j 4 specifies that I want to use 4 CPU threads. You can check how many threads your CPU has by running nproc

Longeron answered 8/5, 2023 at 4:37 Comment(0)
S
1

Currently there is same issue in Anaconda prompt (Anaconda3) on Windows 10. Here is workaround: https://github.com/ContinuumIO/anaconda-issues/issues/10576

Salzhauer answered 6/8, 2019 at 11:29 Comment(0)
R
1

Fixed this without having to change anything related to TSL/SSL.

I was trying to see if the same thing was happening to pip, and saw that pip was broken. Did some digging and realized it's probably caused by Homebrew deleted python@2 on February 1st, 2020.

Running brew uninstall python@2 to delete python2 installed by Homebrew.

Destroyed the virtual env created using python3 and created a new one.
pip3 installing works fine again.

Readjust answered 24/2, 2020 at 7:47 Comment(1)
For me, switching to an older version of openssl worked: brew switch openssl 1.0.2t I'm on Mac OS Catalina 10.15.3. Hope it helps.Anneal
H
1

I am on macOS and I had used brew but what Vaulstein mentioned in his answer didn't cover my case.

I run the following commands to make sure my current python was not installed by brew

brew list | grep python           
python
python@2

brew info python
[email protected]: stable 3.8.3 (bottled)
Interpreted, interactive, object-oriented programming language
https://www.python.org/
Not installed
... 

So I download the latest 3.8.5 from https://www.python.org/ and when installing it I saw following information

Certificate verification and OpenSSL

This package includes its own private copy of OpenSSL 1.1.1. The trust certificates in system and user keychains managed by the Keychain Access application and the security command line utility are not used as defaults by the Python ssl module

After installed 3.8.5 it fixed the problem.

Hermaherman answered 7/9, 2020 at 9:15 Comment(0)
S
1

I got into this problem using Ubuntu, pyenv and Python 3.8.1 managed by pyenv. There was actually no way to get pip to work correctly, since every time I tried to install anything, including pip itself, the same error showed up. Final solution was to install, via pyenv, a newer version, in this case 3.8.6. Apparently, from 3.8.4 Python is prepared to run SSL/TLS out of the box, so everything worked fine.

Schoenburg answered 13/10, 2020 at 7:8 Comment(0)
L
1

I simply solved the problem with following command:

brew upgrade [email protected]

SSL is included by default on this version!

Librium answered 22/1, 2021 at 11:53 Comment(0)
R
1

In my case I was running into issues with my $PATH on Linux. This can also happen on MacOS.

Check to see if /usr/bin/pip3 install package_name_goes_here works for you. If so then run which pip3 this will tell you which is the first directory that pip3 is installed in.

If it is something like /usr/local/bin/pip3 which is different from /usr/bin/pip3 then you may need to adjust your $PATH.

Run echo $PATH and copy the result.

The PATH is simply a colon separated list of directories that contain directories. Bash will always return the first instance of the program that you are attempting to execute. Move all the system directories upfront. Here is a list of some of the system directories:

/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin

If that fails then verify you have openssl installed by running openssl version -a if not then install openssl.

Reiter answered 22/2, 2021 at 17:31 Comment(0)
P
1

If you've installed anaconda via scoop, and encounter this error while using pip from within a conda environment you can resolve it by...

  1. Adding these to your path
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Scripts
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Library
C:\Users\YOUR_USERNAME\scoop\apps\anaconda3\current\Library\bin
  1. Installing openssl via scoop
scoop install openssl
  1. And copying the following DLLs from ..\anaconda3\Library\bin to ..\anaconda3\DLLs

References:

Prefecture answered 7/8, 2021 at 10:39 Comment(0)
A
1

I exited my virtual environment and upgraded pip.

Adigranth answered 27/10, 2023 at 7:12 Comment(0)
U
0

I ran into this problem! I accidentally installed the 32-bit version of Miniconda3. Make sure you choose the 64 bit version!

Unborn answered 10/7, 2019 at 4:21 Comment(0)
T
0

This worked for me:

yum install python36-pyOpenSSL 

python version and package manager might differ.

Thithia answered 19/7, 2019 at 19:35 Comment(0)
D
0

You’d try from Anaconda Prompt.

You will see (base), now upgrade pip. Example:

(base) C:\Users\Tom>cd ..

(base) C:\Users>cd ..

(base) C:\>python -m pip install --upgrade pip
Requirement already up-to-date: pip in g:\anaconda3\lib\site-packages (20.0.2)

(base) C:\>pip -V
pip 20.0.2 from G:\Anaconda3\lib\site-packages\pip (python 3.7)

# Try install
(base) C:\>pip install selenium

This takes a longer time, but will also install or upgrade SSL libraries that Anaconda uses internally. Keep Going here

Delacruz answered 29/4, 2020 at 0:13 Comment(1)
This answer assumes using conda on Windows, not vanilla python on Linux as the OP indicatedUnship
D
0

You could try brew link and it will show you the proper instruction:

$ brew link openssl --force
Warning: Refusing to link macOS provided/shadowed software: [email protected]
If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
Discord answered 30/7, 2020 at 23:46 Comment(0)
Z
0

I had the same issue and it was because I changed the folder of the environment. I just removed the env and reinstalled everything.

Zel answered 29/12, 2020 at 10:8 Comment(0)
K
0

I was getting the same error:

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/pb-tool/
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/pb-tool/
ERROR: Operation cancelled by user
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

In Anaconda I did it with this command:

conda install anaconda-navigator

It was mentioned in this article : pip is configured with locations that require TLS/SSL however the ssl module in Python is not available

Kersten answered 7/3, 2022 at 15:12 Comment(0)
C
0

Even after trying all the above steps, i was getting the same error. So while we work in a lab and have authorised access to Internet,the issue was with old versions on servers. So i created a virtual environment and placed all my imported modules there. Gave all the necessary permission to the file and the user. Then i gave the internet access to the server system. It worked fine. Try checking for any access and permission issue you might have. Hope it helps. Thanks.

Cortney answered 30/3, 2023 at 12:56 Comment(0)
T
-1

For Miniconda3 under Windows 10 with python=3.7.5 I tried all above suggestions; nothing worked. I had to downgrade to python=3.7.0 which solved the issue

conda install python=3.7.0

Obviously this is quite messy. The answers suggest that an upgrade to 3.8.5 might also work but this had too many side effects in my env.

Tientiena answered 5/8, 2021 at 9:13 Comment(0)
R
-1

Install openssl first.

If you are facing this issue in conda environment, you can install openssl using conda install -c anaconda openssl. It enables ssl for you!

Respirable answered 21/5, 2022 at 16:30 Comment(0)
E
-1

After trying to compile python myself and still lacking the ssl module, i finally tried to just install the missing module from apt like this:

apt install python3-openssl

Elledge answered 19/8, 2022 at 11:36 Comment(0)
G
-2

I tried:

python -m pip install --upgrade pip

And After that, it works fine for me in Windows 10.

Galibi answered 10/11, 2019 at 14:51 Comment(2)
How is pip supposed to upgrade pip if pip doesnt work?!Rescissory
The question says "pip is configured with locations that require TLS/SSL". I had the same problem and the answer I wrote is how I fixed it.Galibi
B
-3

This is the problem with your default ssl setting. You gotta download the Python3 and add the path to your system. If you use Pycharm, set the interpreter to your python3 path. Then you can normally use the pip3 without error.

Bosporus answered 23/2, 2020 at 3:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.