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

202,462

Solution 1

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.

Solution 2

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! "

Solution 3

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

Solution 4

I got it solved by installing OpenSSL according to the following recommendation: https://github.com/conda/conda/issues/8046#issuecomment-450515815

Corresponding ticket in the conda repository: https://github.com/conda/conda/issues/8046

Update: the problem (in PyCharm) should be solved in 2019.1 version (Early Access Preview build is already available https://www.jetbrains.com/pycharm/nextversion/).

Solution 5

this issue was driving me insane until i found this post which said to do

brew upgrade python3 

(not using pycharm, using sublime)

Error when importing ssl in Python 3.7.4 on macOS 10.14.6

Share:
202,462

Related videos on Youtube

Frank Drin
Author by

Frank Drin

Updated on May 05, 2022

Comments

  • Frank Drin
    Frank Drin about 2 years

    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. -

  • Stepan Yakovenko
    Stepan Yakovenko almost 5 years
    there are many binaries there, which one exactly? It would be cool to make exact link or screenshot. I used first link with MSI file and it worked, thank you friend: slproweb.com/download/Win64OpenSSL_Light-1_1_1b.msi
  • hui chen
    hui chen almost 5 years
    Although don't know why we have to export multiple paths, but it works for me, thanks.
  • ERJAN
    ERJAN over 4 years
    THIS WORKED FOR ME! not "execstack ..." cmd but this one! adding path/anaconda3/library/bin worked for me
  • Alex Dana
    Alex Dana about 4 years
    Not sure to understand how/where do we have to add this 3 paths ?
  • Paul Stevens
    Paul Stevens about 4 years
    Alex - add these items to the PATH environment variable (e.g see Mukesh Methaniya/Neuron answer below)
  • Henry Navarro
    Henry Navarro about 4 years
    Where do I have to add these paths? I am trying to run a python code from specific folder using python get-pip.py
  • Kevin Vasko
    Kevin Vasko almost 4 years
    Same versions of everything for me. Windows 10 Miniconda which had 3.7.4. Fixed with this solution.
  • Lou
    Lou over 3 years
    This worked for me too! Thanks for going through all the debugging steps :)
  • Sergey Shubin
    Sergey Shubin over 3 years
    Welcome to StackOverflow! This solution was already proposed in another answers. Please make sure that your solution is new before posting it.
  • Loïc G.
    Loïc G. over 3 years
    Just needed to Add Interpreter then to choose existing environnement and it did the trick. No need to recreate the project.
  • EliSquared
    EliSquared about 3 years
    Worked on Anaconda Python 3.8.3 on a Windows 10 server. Just had to alter the local path environment variable.
  • Denziloe
    Denziloe almost 3 years
    Not sure what "not a reasonable request" means, but it is actually generally good practice for avoiding weird errors, and it resolves this error too. It's not hard, just enter code in the prompt to launch VS Code.
  • Haitham Gamal
    Haitham Gamal almost 3 years
    Works for me. Thank you.
  • Adam DS
    Adam DS over 2 years
    Great thank you for this! VSCode just completed its monthly auto-update on my machine and all of a sudden this problem appeared and your solution worked perfectly :)
  • Tim John
    Tim John over 2 years
    This solution is much better than setting ssl_verify: false as suggested in other posts (e.g., stackoverflow.com/questions/42563757/…). Apparently, that solution has security issues
  • Micah
    Micah over 2 years
    Where do you set the path? Add "new" and then make a path for each of the Anaconda3 folders?
  • Micah
    Micah over 2 years
    It seems like my User variables only allow for one PATH, it keeps replacing my old PATH so I can't get all 3. Can Anyone help me?
  • Micah
    Micah over 2 years
    stackoverflow.com/questions/60974818/… This solved my problem: Use ; to separate each path.
  • An old man in the sea.
    An old man in the sea. over 2 years
    I added so many environment variables, installed the OpenSSL thingy, and nothing worked... Until I tried your last solution. :)))