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

11

38

I have the anaconda package and run Spyder. Here is my system information:

anaconda                  2018.12                  py37_0

Python                    3.7.1

pip                       18.1

Dell Inspiron 13 7000 64-bit

I am unable to install anything with pip from the command prompt. I get the following when trying to install numpy for instance (which I already have through anaconda):

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

Requirement already satisfied: numpy in c:\users\uday rallabhandi\anaconda3\lib\site-packages (1.15.4)

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

Please help me understand why this is happening.

Chabazite answered 28/1, 2019 at 2:21 Comment(2)
related: #41328951Mitziemitzl
github.com/explosion/spaCy/issues/2208Mitziemitzl
F
34

Here was my process to correct the error, on Windows 10 with Anaconda:

  1. Added the following paths to my environment variables:
  • /AppData/Local/Continuum/Anaconda3
  • /AppData/Local/Continuum/Anaconda3/Scripts
  • /AppData/Local/Continuum/Anaconda3/Library
  • /AppData/Local/Continuum/Anaconda3/Library/Bin

At this stage, the error message was still there.

  1. From Anaconda Prompt, I installed the latest version of pip:

    python -m pip install --upgrade pip
    

This appeared to correct the DLL conflict.

Ferraro answered 2/9, 2019 at 8:38 Comment(5)
Worked for me on Win10. Why is /Library not added to PATH by anaconda3 by default?!Quillon
This solution was the only one that works for me thank you very much. Win 10 proMilicent
that solution works. that file anaconda3\Library\bin\libssl-1_1-x64.dll should be in $PATHDependency
Worked for me as well but I didn't have to upgrade pip (Windows 10). @DmitryAvtonomov I think Anaconda installer now gives you the option whether to add to path or not. By defualt the option is not selected and it's "not recommended"Conservatoire
If the environment is within QGIS and Anaconda is not in the equation at all, is there an alternative? None of these solutions work for me.Indusium
G
19

I had exactly the same problem. My computer is exactly the same and the versions of Python and pip are also the same.

It's a dll conflict with libeay32.dll.

I can solve this problem by adding dir path of python which has libeay32.dll (in my case C:\Users\Gabriel\Anaconda3\pkgs\openssl-1.1.1a-he774522_0\Library\bin) in system environment as topmost position.

Guinn answered 5/2, 2019 at 9:35 Comment(1)
i have: .../pkgs/openssl-1.1.1a-he774522_0, but no libeay32.dll. where else can i find it for win 8.1?Mitziemitzl
F
10

I had the same issue when I created a new environment in anaconda, activated it and tried to install a library with pip. What was missing was:

conda install pip

then everything worked for me.

Faubourg answered 29/2, 2020 at 12:2 Comment(2)
Not the same situation as I already had a currently operational pip, but something did get mucked up by me. Either way, this also served to solve my issue before taking the nuclear approach! thanks!Streetcar
Very helpful! Just to add to this, the environment was working fine before but probably openssl updated and pip could not update itself, so once I used "conda upgrade pip" it updated the openssl package and then pip started working fine again.Exteroceptor
F
7

Try your install/update with pip3 instead of pip.

Florettaflorette answered 28/1, 2019 at 2:26 Comment(0)
O
7

I do not have libeay32.dll in bin folder either, but after adding C:\Users\<user name>\Anaconda3\pkgs\openssl-1.1.1a-he774522_0\Library\bin to the top of path, it is working. This is on Windows 10 64-bit.

Ormond answered 21/2, 2019 at 5:11 Comment(0)
H
6

Activate your base conda environment:

conda activate base

Homoousian answered 17/7, 2019 at 15:28 Comment(0)
R
4

Adding "<Path to miniconda or anaconda>\Library\bin" folder to PATH solved this problem for me.

Rockies answered 4/11, 2019 at 19:31 Comment(0)
S
1

Add <Path to miniconda or anaconda>\Library\bin folder to PATH or
cd <Path to miniconda or anaconda>\Library\bin>

Syllabogram answered 23/7, 2021 at 13:49 Comment(0)
T
0

Activating the base and then activated my Django environment.

(Django_env) (base) C:\virtual_environment\Django_env> , which actually worked for me.

Tillie answered 21/8, 2019 at 12:36 Comment(0)
P
0

I need to add a different answer here:

For so many years moving forward, we have a lot of new python versions(up to python3.13 now), but some users are still using old linux version like centos-6, which has end its life.

On those old linux, please remember do not install any new python versions, for example you should install 3.6.5 on centos 6.8, if you try to install a python3.7.x or a 3.6.14 import ssl might fail even if you've installed all the ssl deps(libssl/openssl and it's dev).

In the end, upgrade your os version asap.

Pericarp answered 20/5 at 2:49 Comment(0)
I
-1

just a note how to find wich library is missing

$ python -m ssl
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/ssl.py", line 99, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: libssl.so.1.1: cannot open shared object file: No such file or directory
Inspection answered 25/4, 2023 at 7:31 Comment(1)
Everyone above is talking about Windows, but these are Linux paths. Also, I tried this on my Windows machine - python -m ssl runs without error, but I still can't install anything using pip.Belicia

© 2022 - 2024 — McMap. All rights reserved.