no module named keras

No module named keras : Step by Step Fix

We can fix no module named Keras using installing and reinstalling keras. We can install the Keras module using pip, conda, source code, etc.

No module named keras : Fix-

Here are so many ways to fix this error. Lets explore them one by one.

Method 1 : Using pip manager-

If we get this error (no module named keras), We may install the keras module again. It will surely fix this error. Here is the way to install keras using pip.

pip install Keras

"no

Method 2: Using conda manager –

Well, Like pip we can use the default package manager of Anaconda. Here is the below command to install / reinstall keras using conda manager.

conda install -c conda-forge keras

Method 3: Using source code via git-

Here we will not install keras using any package manager. We will directly download the source code using git. Then we will run the setup.py file. Please refer the below steps for this.

git clone https://github.com/keras-team/keras.git
cd keras
python setup.py install

Here we may need to set keras home as it is invoking internally tensorflow core.

$HOME/.keras/keras.json

The above command is only giving the path to the required configuration file.

Few Notes :

1. If any of the method is not working for you. Please search and remove the previous install version of keras. Now try any of the method, It will fix your issue of no module named keras.

2. If you are using the Linus based OS. You may try sudo with any of the methods. In Linux, If you have python 3 installed, Please use the below command.

sudo pip3 install keras

 

Conclusion –

This error (no module named keras) occurs only when either keras is not installed or its path is not properly set. Well, In this article, We have tried to provide so many ways to fix it. Please choose any of them [ pip, conda or setup.py]. Even after trying all of them, You are getting the same error.Please comment below. We will look into it together.

Thanks
Data Science Learner Teams

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

 
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner