No module named 'keras'

2,697 views
Skip to first unread message

peter cohen

unread,
Apr 1, 2018, 12:59:00 PM4/1/18
to Keras-users
Hello, I installed keras in Ubuntu. When I tried to use it, I got the following error. Could you please let me know how to fix it? Thanks.

Import keras
moduleNotFoundError: No module named 'keras'

Mudit Verma

unread,
Apr 1, 2018, 1:00:50 PM4/1/18
to Keras-users
Check installation of keras again.

It is possible that you have multiple python installations, and the one you execute your script on is different from the one where you installed keras.

colorfu...@gmail.com

unread,
Apr 1, 2018, 3:16:20 PM4/1/18
to Keras-users
I used: sudo pip3 install keras

to install keras. I have both Python 3.6.3 and 2.7.14 installed.



2018年4月1日日曜日 13時00分50秒 UTC-4 Mudit Verma:

Matias Valdenegro

unread,
Apr 1, 2018, 3:34:14 PM4/1/18
to keras...@googlegroups.com

Hi, please include the output of the following commands:

 

pip show keras

 

python -c "import sys;print(sys.path)"

colorfu...@gmail.com

unread,
Apr 1, 2018, 4:07:34 PM4/1/18
to Keras-users
Hello,

At first I typed "pip show keras". The system asked me to perform a "pip install --upgrade pip".

Then, when I typed "pip show keras" again. Nothing showed up. Next, I typed: "python -c "import sys;print(sys.path)"

The system returned:

[ ' ', '/home/peter/anaconda3/lib/python36.zip', '/home/peter/anaconda3/lib/python3.6', '/home/peter/anaconda3/lib/python3.6/lib-dynload', '/home/peter/.local/lib/python3.6/site-packages', '/home/peter/anaconda3/lib/python3.6/site-packages' ]





2018年4月1日日曜日 15時34分14秒 UTC-4 Matias Valdenegro:

Matias Valdenegro

unread,
Apr 1, 2018, 4:19:10 PM4/1/18
to keras...@googlegroups.com

You said you used pip3 to install keras, then you should do pip3 show keras instead. I note that you are using anaconda and that might be the problem. As you are on Linux there is really no need to use anaconda and it might bring more problems than it solves.

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages