Solving PyCharm Error – Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)

Solving PyCharm Error – Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”) is an error which happens when you have not installed OpenSSL.

In this article I am going to explain what happens when you get this error and how you can solve it with a main solution, we will also explore other solutions which can possibly solve the issue.

Explaining PyCharm Error – Caused by SSLError(“Can’t connect to HTTPS URL because the SSL module is not available.”)

The problem happens for many reasons, one of them is a faulty python or anaconda installation, another possible cause is not having OpenSSL.

Here is an example of the error message.

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

Bellow I make my best attempt at solving the error and present multiple possible solutions.

Solution 1 : Installing pyOpenSSL

The easiest solution to the issue is to try installing pyOpenSSL by running the command bellow.

                                                                       #
pip install pyOpenSSL
                                                                       #

If that does not work, start by installing the dependencies needed by pyOpenSSL , you can do that by running the command bellow.

                                                                       #
pip install pyopenssl ndg-httpsclient pyasn1
                                                                       #

If this is not enough then your problem is deeper than that. Continue reading

Solution 2 : edit the env variables

For Anaconda users, another solution is to edit the environment variables.

First, on windows go to the search bar next to the windows icon.

Type environment variables and click on the window which is going to show up.

Look for PATH and then click edit.

Enter the three paths bellow. Then save the changes and exit.

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

This error could be confusing at first. But once you understand why it is happening, it is easy to solve.

Summing-up

That is it guys, this is the end of this article / guide, I hope you found it useful in solving your particular problem, you can support our work on our Kofi account, you do not have to but you can donate if you want.

Thank you for reading, keep coding and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/