Import keras.datasets not working

patapouf_ai picture patapouf_ai · Feb 16, 2016 · Viewed 15.6k times · Source

I have keras installed on my linux machine, but when I try to import a dataset from the keras.datasets I get an error that it cannot find it.

So for example:

from keras.datasets import mnist

I get the error

ImportError: No module named keras.datasets

I installed keras using pip install and it installed successfully.

Answer

Justin Shenk picture Justin Shenk · Mar 5, 2017

Do you have keras.py or keras.pyc in the current working directory? If so, this will mess up the imports. Try renaming the file and/or deleting keras.pyc.