ImportError: No module named tensorflow

Abhishek Gangwar picture Abhishek Gangwar · Feb 15, 2017 · Viewed 289.2k times · Source

Please help me with this error

I have installed the tensorflow module on my server and below is it's information

15IT60R19@cpusrv-gpu-109:~$ pip show tensorflow
Name: tensorflow
Version: 1.0.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: [email protected]
License: Apache 2.0
Location: /home/other/15IT60R19/anaconda2/lib/python2.7/site-packages
Requires: mock, numpy, protobuf, wheel, six

But when I try to import tensorflow I get following error

>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow

My python version is as following

Python 2.7.12 |Anaconda 2.5.0 (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

I have tried the solutions given in sol1

Sol2

I do not have sudo access to the server I can only use pip to install any module

Answer

Dharma picture Dharma · Aug 7, 2017

Try installing tensorflow again with the whatever version you want and with option --ignore-installed like:

pip install tensorflow==1.2.0 --ignore-installed

I solved same issue using this command.