5

I'm trying to load data from a github page (it's part of the standard seaborn datasets you can get.) I am on PyCharm and I don't understand what the hell is going on.

import seaborn as sns

data = sns.load_dataset("tips")

Then I get the error. Why am I getting this error?

/usr/local/bin/python3.7 "/Users/shahbhuiyan/Desktop/PyCharm Projects/Pandas/pycharmtest.py"

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>


2 Answers2

10

I encountered the same issue and found the solution here: http://www.programmersought.com/article/2877138500/

Basically, just add these two lines of code, then try importing the data set:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

This way, python will ignore verification of the security certificate

Romy Li
  • 101
  • 1
  • 3
  • 1
    As a workaorund, it works but this actually disables the certificate verification. right? – Rene Apr 27 '21 at 10:20
0

Open the terminal of MAC OS and try this command: "/Applications/Python 3.6/Install Certificates.command"

This works for me because Python 3.6 on MacOS uses an embedded version of OpenSSL, which does not use the system certificate store. More details here.

Med El
  • 1
  • 2