I am trying to import the module keras.utils.data_utils
but its not working. However, I can find this module here. It is indeed existing. Why I cannot import it while I can import some other modules likekeras.models
and keras.layers.core
?
cliu@cliu-ubuntu:bin$ python
Python 2.7.9 (default, Apr 2 2015, 15:33:21)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import print_function
>>> from keras.models import Sequential
>>> from keras.layers.core import Dense, Activation, Dropout
>>> from keras.layers.recurrent import LSTM
>>> from keras.utils.data_utils import get_file
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named data_utils
Edit:
See here for the answer.
Even though this answer is correct but is not complete. Thanks to Ben J.'s answer but Tadhg McDonald-Jensen is the first one offering me the answers here.
Summarize it
I was using pip install keras
to install keras
, but it did not install the latest version of keras
according to this. That is why I could do things like from keras.models import Sequential
, from keras.layers.core import Dense, Activation, Dropout
, and from keras.layers.recurrent import LSTM
but not from keras.utils.data_utils import get_file
. Because it is not in the previous versions.
SO, just clone
the keras
from their github, cd
into it, and run sudo python setup.py install
will solve this problem.
REMEMBER, if you already did this pip install keras
, you have to make sure clear all keras
versions you have installed by doing this pip uninstall keras
many time until no keras
existing, then do this sudo python setup.py install
.
I looked at the tar.gz from https://pypi.python.org/pypi/Keras/0.1.3 and there is no file named data_utils.py in the utils folder. However the github does include this file: https://github.com/fchollet/keras.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With