title: Keras mnist dataset import
body: <p>I am trying to import mnist dataset using keras code in Macbook. but it is giving the error below. </p>
  
  
  
  <pre class="lang-python prettyprint-override"><code># Loading the data
  from keras.datasets import mnist
  
  (x_train, y_train), (x_test, y_test) = mnist.load_data()
  </code></pre>
  
  <p>The error I am getting:</p>
  
  <pre class="lang-python prettyprint-override"><code>During handling of the above exception, another exception occurred:
  
  Exception                                 Traceback (most recent call last)
  &lt;ipython-input-11-fdb6855f8337&gt; in &lt;module&gt;()
        2 from keras.datasets import mnist
        3 
  ----&gt; 4 (x_train, y_train), (x_test, y_test) = mnist.load_data()
  
  /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/datasets/mnist.py in load_data(path)
       21     path = get_file(path,
       22                     origin='https://s3.amazonaws.com/img-datasets/mnist.npz',
  ---&gt; 23                     file_hash='8a61469f7ea1b51cbae51d4f78837e45')
       24     f = np.load(path)
       25     x_train, y_train = f['x_train'], f['y_train']
  
  /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/data_utils.py in get_file(fname, origin, untar, md5_hash, file_hash, cache_subdir, hash_algorithm, extract, archive_format, cache_dir)
      222                 urlretrieve(origin, fpath, dl_progress)
      223             except URLError as e:
  --&gt; 224                 raise Exception(error_msg.format(origin, e.errno, e.reason))
      225             except HTTPError as e:
      226                 raise Exception(error_msg.format(origin, e.code, e.msg))
  
  Exception: URL fetch failure on https://s3.amazonaws.com/img-datasets/mnist.npz: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>(Note: I tried to remove files from <code>.keras/datasets/</code> as in said in this <a href="https://github.com/keras-team/keras/issues/2519" rel="nofollow noreferrer">issue</a> )</p>