Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website

Using requests in Python3 Windows via Pycharm, and receiving SSL Module Not Available Error

I've spent hours trying to figure out what could be causing this. I've reinstalled Anaconda, and I am completely stuck. When running the following

def Earlybird(daycount):
    url = 'https://msft.com'
    response = requests.get(url)
    print(response)
Earlybird()

I receive the error

requests.exceptions.SSLError: HTTPSConnectionPool(host='msft.com', 
port=443): Max retries exceeded with url: / (Caused by SSLError("Can't 
connect to HTTPS URL because the SSL module is not available."))

I have no idea what could be causing this. As Anaconda is a recent install, I would assume everything would be up-to-date, so I'm unsure if this is pointing to the wrong SSL ? I am a bit new to python, so thanks for your patience. -

like image 914
Frank Drin Avatar asked Jan 10 '19 18:01

Frank Drin


People also ask

Can \' t connect to https URL because the SSL module is not available anaconda?

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.

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 python Centos?

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.


3 Answers

Don't know if this has been solved yet but I was getting similar problems with Anaconda python 3.7.3 and Idle on Windows 10. Fixed it by adding:

<path>\Anaconda3
<path>\Anaconda3\scripts
<path>\Anaconda3\Library\bin

to the PATH variable.

like image 68
Paul Stevens Avatar answered Oct 18 '22 00:10

Paul Stevens


I am on Windows 10, I had the problem with a new fresh installation of Anaconda on python 3.7.4, this post on github solved my problem:

( source: https://github.com/conda/conda/issues/8273)

I cite:

" My workaround: I have copied the following files

libcrypto-1_1-x64.*
libssl-1_1-x64.*

from D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs.

And it works as a charm! "

like image 24
Matt Dnv Avatar answered Oct 17 '22 23:10

Matt Dnv


Windows Users need to set below paths:

  • ..\Anaconda3
  • ..\Anaconda3\scripts
  • ..\Anaconda3\Library\bin

Per user:

  1. Open Environment variable
  2. Click User Variable
  3. Close command prompt if already open and reopen it

System wide (requires restart):

  1. Open Environment variable
  2. Click System Variable
  3. Restart Windows
like image 20
Mukesh Methaniya Avatar answered Oct 18 '22 01:10

Mukesh Methaniya