Unable to import tensorflow | Sololearn: Learn to code for FREE!

+1

Unable to import tensorflow

I installed python 2.7 and then manually installed tensorflow using whl file... it successfully got installed and I could find the same using pip list command. I got tensorflow 1.10.0 , but when I do use import tensorflow command, it says module is not found.. any thoughts on this would be of great help.

2/21/2019 4:21:12 PM

Ketan Lalcheta

4 Answers

New Answer

+5

Yes, that means you had the PYTHONPATH variable not set accordingly. Normally, pip should have taken care of that, but since you built it from whl it might have got confused. Good job resolving that on your own! 👍

+4

Do you happen to have more than one Python installed? Perhaps Python 3 or Anaconda installation? Maybe you got the pip confused? If not, might be a good idea to try installing it with virtualenv, that would surely take care of the dependency problem: https://www.tensorflow.org/install/pip?lang=python2 Oh, and the last thing -- it most likely won't go on Windows at all, as the official tensorflow distribution for this OS only supports Python 3.5+

0

no I don't have multilple python installed... not even anaconda..only 1 version is installed... I heared somewhere that tensorflow works only with 2.7 and 3.6 python.. so, I started with 2.7 only... additionally what is virtualenv ? I am afraid to install it as it should not disturb os or other software or windows... is this a whl file to be installed using pip install command...? does virtualenv is specific to python only...? I am sorry to ask so many questions in a go.

0

I earlier installed python 2.6 and 3.6 also and uninstalled both of them before installing python 2.7... but looking into your comment of multiple versions, checked path variable and found only two paths ... one for python path and other for pip path both for 2.7... still deleted both of them and added only one path that is upto exe location of python... after this I went CMD and checked pip list... tensorflow was there in list.. went to python window and imported tensorflow... it worked to my surprise... I don't know how it worked... but problem is resolved.... thanks a lot Kuba SiekierzyƄski