keras module not found (No module named 'keras')

Viewed 3404

I tried to import keras to my ANN model but I found this Module not found the type of error. I tried tp import from tensorflow.keras but still it's the same problem. enter image description here

No module named 'keras'

4 Answers

Try importing keras first. Try:

from numpy import loadtxt
import keras
from keras.models import Sequential
from keras.layers import Dense

If this doesn't work, try using TensorFlow: pip install tensorflow and:

from tensorflow.keras import Sequential

from tensorflow.keras import Sequential

!pip install keras on jupyter notebook

I think this problem is related to the environment. Your TensorFlow module may be installed in a different env. and Keras is in a different env. So, try to uninstall the Keras module and reinstall it.

$ pip uninstall keras
$ pip install keras

If this doesn't work, try using TensorFlow: pip install tensorflow and:

from tensorflow.keras import Sequential
Related