Keras: cant load the mnist dataset

Created on 8 Jan 2016  路  7Comments  路  Source: keras-team/keras

i try to load the mnist dataset by writing :
from keras.datasets import mnist
(x_train,y_train),(x_test,y_test)=mnist.load_data()

but i get the following error :
IOError: CRC check failed 0xc187cf56L != 0x14c5212fL

how can i fix this error??

Most helpful comment

For OSX 10.11.3 using Python3.6, here's what worked for me. To the top of

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/data_utils.py

just below the import statements, add:

import requests
requests.packages.urllib3.disable_warnings()
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
    pass
else:
    # Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

Restart Python and it will hopefully work

All 7 comments

i also tried to mnist.py in my keras datasets directory to download the dataset but i get the following error
ValueError: Attempted relative import in non-package

rm ~/.keras/datasets/* and retry.

For OSX 10.11.3 using Python3.6, here's what worked for me. To the top of

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/data_utils.py

just below the import statements, add:

import requests
requests.packages.urllib3.disable_warnings()
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
    pass
else:
    # Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

Restart Python and it will hopefully work

@dderiso 's code change worked for imdb dataset too

@dderiso worked for me.. Thanks

Thank @dderiso it work for me.

nice. I've done it and my VM bricked. hahahahahaha What the hell...

I found the file data_utils.py and copied the code insertion. After reboot the system, it won't boot anymore...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trane293 picture trane293  路  90Comments

patyork picture patyork  路  73Comments

lmoesch picture lmoesch  路  89Comments

wx405557858 picture wx405557858  路  71Comments

parag2489 picture parag2489  路  64Comments