Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named keras #4889

Closed
twangnh opened this issue Jan 1, 2017 · 18 comments
Closed

No module named keras #4889

twangnh opened this issue Jan 1, 2017 · 18 comments
Labels

Comments

@twangnh
Copy link

@twangnh twangnh commented Jan 1, 2017

I have installed Anaconda package on a server as a user account, then I use conda install keras to install keras on it, but then when I run import keras, it raised no module named keras, anyone can help? thanks very much!

@nzw0301
Copy link
Contributor

@nzw0301 nzw0301 commented Jan 1, 2017

Did your command (: conda install keras) succeed?

keras cannot be installed by conda install keras because package not found.
(my anaconda is anaconda3-4.1.1)

I recommend use pip install keras to install keras.

@raul-jr3
Copy link

@raul-jr3 raul-jr3 commented Apr 23, 2017

I had the same issue when i installed keras using conda

I removed it and then installed using sudo pip3 install keras and it worked.

@stale stale bot added the stale label Jul 22, 2017
@stale
Copy link

@stale stale bot commented Jul 22, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

@recs84
Copy link

@recs84 recs84 commented Aug 7, 2017

sudo pip3 install keras fixed it, thanks!

@stale stale bot removed the stale label Aug 7, 2017
@stale
Copy link

@stale stale bot commented Nov 5, 2017

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

@stale stale bot added the stale label Nov 5, 2017
@stale stale bot closed this Dec 5, 2017
@annanurov
Copy link

@annanurov annanurov commented Apr 16, 2018

I had the a similar problem. Following steps helped

1- Open Anaconda Prompt with admin privileges (in windows: right click -> open as admin, etc)
2- Type the command to install you package, e.g.:
conda install -c conda-forge keras tensorflow
If not sure about package name, search web for it.

3- Test if the package was installed correctly. E.g. launch Spider from Anaconda and use command
import keras

4- Restart Rstudio (Session -> Restart R) before trying
library(keras)

PS: now you have to deal with TF's internal errors and warnings like
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
But, that's a whole different story.

@Muthuramansivakumar
Copy link

@Muthuramansivakumar Muthuramansivakumar commented Aug 6, 2018

If you are using Anaconda 3.6 version, you can type the below command in Anaconda prompt to install keras

conda install -c conda-forge keras

Followed by try importing Dense and sequential libraries from the keras package

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

Hope it works

Thanks

@MayankMurali
Copy link

@MayankMurali MayankMurali commented Sep 18, 2018

I had the a similar problem. Following steps helped

1- Open Anaconda Prompt with admin privileges (in windows: right click -> open as admin, etc)
2- Type the command to install you package, e.g.:
conda install -c conda-forge keras tensorflow
If not sure about package name, search web for it.

3- Test if the package was installed correctly. E.g. launch Spider from Anaconda and use command
import keras

4- Restart Rstudio (Session -> Restart R) before trying
library(keras)

PS: now you have to deal with TF's internal errors and warnings like
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX
But, that's a whole different story.

Thanks a lot mate for the detailed steps :)

@srikant132
Copy link

@srikant132 srikant132 commented Dec 20, 2018

ModuleNotFoundError Traceback (most recent call last)
in ()
----> 1 import keras

ModuleNotFoundError: No module named 'keras'
this is the issue after installing through conda

@coxymla
Copy link

@coxymla coxymla commented Mar 6, 2019

I had the same problem and it turned out that conda was not adding the environment site-packages onto the python path.

e.g.
import sys print (sys.path)

did not have C:\ProgramData\Anaconda3\envs\foo\Lib\site-packages present.

I set environment variable PYTHONPATH to C:\ProgramData\Anaconda3\envs\foo\Lib\site-packages and now python can find the packages present within virtual environment.

@pissw2016
Copy link

@pissw2016 pissw2016 commented Jun 21, 2019

I restart my conda environment by conda deactivate and then conda activate tf13 and it solved.before this I reinstall my keras by uninstall anything with keras in my tf13 environment.

@VedhaMukund
Copy link

@VedhaMukund VedhaMukund commented Sep 14, 2019

what to do in jupyter , no module not found

@jimgitonga
Copy link

@jimgitonga jimgitonga commented Sep 23, 2019

run this command in anaconda prompt
conda install -c conda-forge keras tensorflow

@TheUsmanMirza
Copy link

@TheUsmanMirza TheUsmanMirza commented Oct 30, 2019

"pip3 install keras"
worked for me

@ghost
Copy link

@ghost ghost commented Mar 28, 2020

Thanks all, I realized I was in the wrong environment.

@kashishmadan
Copy link

@kashishmadan kashishmadan commented Jun 15, 2020

pip install keras worked for me!

@Tjossul
Copy link

@Tjossul Tjossul commented Jul 12, 2020

Hello,

please know that Keras examples worked for me some weeks ago...

I installed Python 3.7 (with env. path), configured with tensorflow and keras:

Name: Keras
Version: 2.4.3
Summary: Deep Learning for humans
Home-page: https://github.com/keras-team/keras
Author: Francois Chollet
Author-email: francois.chollet@gmail.com
License: MIT
Location: c:\users\shopp\appdata\local\programs\python\python37\lib\site-packages
Requires: numpy, scipy, h5py, pyyaml
Required-by:

I installed Keras.NET v3.7.4.2 together with its dependencies.

Today running the image example I got this error:

Python.Runtime.PythonException: "ModuleNotFoundError : No module named 'keras'"

Do you have any what the problem could be after (as I said) it worked some weeks ago?

Thanks.

P.S.: Even after deinstalling Cuda dev. kit, Python and related folders and re-installing Python with Keras and TF I now (!) get this error. This is nothing but crazy!

@MUKESHBADIGINENI
Copy link

@MUKESHBADIGINENI MUKESHBADIGINENI commented Nov 2, 2020

I'm able to import the keras after conda install -c conda-forge keras tensorflow but I couldn't import the layers, while importing I'm encountering the following error

No module named 'keras.layers.img_paths_to_labelsconvolutional'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet