jupyter ModuleNotFoundError: No module named Tensorflow or keras

1.1k views Asked by At

I cannot seem to import Tensorflow or keras. I have windows 10 computer I have python 3.8.5 I installed the following using command pip3 install XXXXXXXXXX 1.matplotlib 2.pandas 3.numpy 4.Tensorflow 5.keras in that order

i have no problem importing matplotlib, pandas or numpy. but when I try to import tensorflow or keras, it cannot find the module (see screenshot provided) i also checked in cmd to ensure i have them installed (see screenshot)

tensorflow and keras package installed

FYI, I installed python in drive F: and windows is installed in drive C: is there a reason why I can import pandas, and not tensorflow or keras? any form of help would be highly appreciated!

screenshot on jupyter error:

screenshot on jupyter error

2

There are 2 answers

1
Gerry P On BEST ANSWER

what version of tensorflow do you want to install? My experience is to use Anaconda onda terminal to install tensorflow. First install tensorflow 2.1 using conda.Conda automatically installs cudnn 7.6.5 and CUDA Toolkit 10.1.243. These are compatible with tensorflow 2.2. Then use pip to install tensorflow 2.2 as shown below

pip install tensorflow ==2.2.0

Conda at this time can only install tensorflow up to 2.1 that is why you have to use pip. pip does not automatically install cudnn or the Cuda toolkit but you already have them installed when you install version 2.1 with Conda. Otherwise you would have to go through a more complicated process to manually install cudnn and the toolkit. Some people have reported problems using python 3.8 with tensorflow. If you run into that create as seperate environment and install python 3.7, tensorflow 2.1 using conda, then install tensorflow 2.2 using pip.

0
Sazzad Hissain Khan On

Although answered in another post, I am coping that here to as relevant,

You can add a cell at the beginning containing,

 !pip install tensorflow

and run it before running to other cells