What to do if you get an error when trying to load mnist

at first

The other day, I touched Tensorflow2 for the first time and tried to learn with the mnist dataset, which is in the position of a tutorial for pattern recognition, and I will write a solution to the trouble that occurred at that time.

Execution code

f.py


import tensorflow as tf
mnist = tf.keras.datasets.mnist
m_data=mnist.load_data()

Error ~ Code

Exception: URL fetch failure on https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)

problem

It seems that there is a problem with ssl and mnist data cannot be obtained.

Solution

Apparently the above error is occurring because the standard ssl on mac doesn't support it. The standard ssl on my Mac was Libre, so I'll change it to openssl. Just type brew install openssl in the terminal. But with this, ssl is still Libre. To change to openssl, when you install openssl If you need to have [email protected] first in your PATH run: echo 'export PATH="/usr/local/opt/[email protected]/bin:PATH"' >> ~/.zshrc Is displayed, so as you say echo 'export PATH="/usr/local/opt/[email protected]/bin:PATH"' >> ~/.zshrc Copy and execute the code in. After that, restart the terminal, enter openssl version, OpenSSL 1.1.1g 21 Apr 2020 If it is displayed as, it is OK. After this it will be in the Python folder If you click on the file Install Certificates.command, mnist can be loaded safely!

Reference article

https://qiita.com/orangain/items/0a641d980019fd7e0c52

Recommended Posts

What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if you get an error when installing python with pyenv
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get an error when trying to send a message in tasks.loop () immediately after startup
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do if you get a must override `get_config` error when trying to model.save in Keras
Workaround if you get an error when trying to install PySide with pip
What to do if you get a Permission denied (public key) error when trying to pull on Github
What to do if you get an "unknown service" error from your gRPC server
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do when you get an error saying "Name resolution temporarily failed" on linux
What to do if an error occurs when importing numpy with VScode
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get a "No versions found" error in pipenv
What to do if you get an error like'Qstring' has already been set to version 1 using mne python
What to do if you get "coverage unknown" in Coveralls
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you run python in IntelliJ and end with an error
What to do if you get a minus zero in Python
[Beanstalk] What to do when an error occurs with import uuid
I get an error when trying to install maec 4.0.1.0 with pip
What to do if you get a UnicodeDecodeError with pip install
What to do when you get "I can't see the site !!!!"
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you get an Undefined error:'Module_six_moves_urllib_parse' object has no attribute'urlencode' on MacOS
What to do if you get the error "Error: opencv3: Does not support building both Python 2 and 3 wrappers" when installing openCV 3
What to do if you get the error RuntimeError: Python is not installed as a framework when trying to use matplitlib and pylab in Python 3.3
What to do if you can't pipenv shell
What to do if you couldn't send an email to Yahoo with Python.
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if pyenv install does not proceed with an error
[Python] What to do when an error related to SSL authentication is returned
What to do if you get Could not fetch URL 443 with pip
What to do if you get angry if you don't have libxml / xmlversion.h when installing lxml on CentOS
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do when psycopg2 throws an error when pipenv lock under Pipenv environment
EC2 / Amazon Linux2: What to do if you get an "unable to execute'gcc': No such file or directory" error with pip install
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if you get a "Wrong Python Platform" warning when using Python with the NetBeans IDE
What to do if you get angry with "Value Error: unknown local: UTF-8" in python manage.py syncdb
[Django] What to do if an Integrity Error occurs when registering data from the management site to the database
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
[python] What to do when an error occurs in send_keys of headless chrome
What to do if Django can't load an image from a static folder
What to do if you get "Python not configured." Using PyDev in Eclipse
[Python] What to check when you get a Unicode Decode Error in Django
If you get a long error when tabbing an interactive shell with Anaconda
What to do if an SSL connection error (ssl.SSLError: [SSL: DH_KEY_TOO_SMALL]) occurs on Ubuntu 20.04
What to do if you can't pip install mysqlclient
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
I get an error when trying meinheld + WebSocket + mongodb