SSL error in accessing MNIST dataset Follow
While trying to open the MNIST dataset...
from keras.datasets import mnist
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()
I get an SSL error...
Exception: URL fetch failure on https://s3.amazonaws.com/img-datasets/mnist.npz: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
I tried accessing the data from a browser and had no problem, so I don't think it's a system issue. So, it seems to be an issue with PyCharm (perhaps related to pip in PyCharm library?). In googling, some have suggested I not use PyCharm to manage libraries (but use only command line). Is this where I'm going wrong? This would make it harder to use VirtualEnv.
How do I resolve this?
Please sign in to leave a comment.
Okay, found the answer. Let me post it here for others...
Mac OSX python ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
Browse to Applications/Python 3.6 folder and double-click Install Certificates.command
Incase of linux...
go to .local/python3.X/lib/python3.6/site-packages/keras/utils/data_utils.py
and below import statements add these----
_create_unverified_https_context = ssl._create_unverified_context
# Legacy Python that doesn't verify HTTPS certificates by default
# Handle target environment that doesn't support HTTPS verification
ssl._create_default_https_context = _create_unverified_https_context
now try new instance of python and ..hopefully it works