No module named keras.models

2,165 views
Skip to first unread message

mohcine...@gmail.com

unread,
Dec 29, 2017, 12:03:18 AM12/29/17
to Keras-users
Hello everyone, I am a newbie in keras, I have installed Keras as in the Keras Documentaion, when I want to run my first program,

import numpy as np
from keras.models import Sequential
from keras.layers import Dense
data = np.random.random((1000,100))
labels = np.random.randint(2,size=(1000,1))
model = Sequential()
model.add(Dense(32, activation='relu',input_dim=100))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer='rmsprop',loss='binary_crossentropy',metrics=['accuracy'])
model.fit(data,labels,epochs=10,batch_size=32)
predictions = model.predict(data)


I got ImportError: No module named keras.models in the line: from keras.models import Sequential

Thanks for helping in advance!


Shagun Sodhani

unread,
Dec 29, 2017, 3:42:43 AM12/29/17
to Keras-users
It is working fine for me. Could you tell us how did you install Keras?

Mohcine Madkour

unread,
Dec 29, 2017, 8:55:45 PM12/29/17
to Shagun Sodhani, Keras-users
I reinstall it using the keras github : https://github.com/keras-team/keras and all modules work fine this time

Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "Keras-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/keras-users/OAgPJgCF5xo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/83d644ab-fb57-4e86-b2c8-ed71582b5fbd%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages