J. Richard
J. Richard

Reputation: 31

How do I fix problems with KERAS

I want to use the full codes from

https://becominghuman.ai/building-an-image-classifier-using-deep-learning-in-python-totally-from-a-beginners-perspective-be8dbaf22dd8

regarding image identifiers. However there is problem with the KERAS. everytime I run

from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense

it gives this:

%run -i "/var/folders/23/fqcfyh1n5992xf4k9w0f40th0000gn/T/tmpP_8Umu.py"
ImportError                               Traceback (most recent 
call last)
/var/folders/23/fqcfyh1n5992xf4k9w0f40th0000gn/T/tmpP_8Umu.py in . 
<module>()
1 from keras.models import Sequential
  2 from keras.layers import Conv2D
  3 from keras.layers import MaxPooling2D
  4 from keras.layers import Flatten
  5 from keras.layers import Dense

ImportError: No module named 'keras.models'

I tried to re-install KERAS, but it doesn't work

sudo pip install git+git://github.com/fchollet/keras.git --upgrade

this doesn't work

The previous codes seems to re-download and re-install KERAS, but still keras.models and keras.layers cannot be loaded and founded.

Upvotes: 3

Views: 1108

Answers (1)

Dr. Snoopy
Dr. Snoopy

Reputation: 56357

You are using an old version of Keras, from fchollet's old repository, the modern repository is https://github.com/keras-team/keras/

You should install keras using pip directly without github, like:

pip install --user keras

This will install the latest version in your use folder. Try to avoid using pip with sudo.

Upvotes: 2

Related Questions