Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named tensorflow

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

like image 325
Abhishek Gangwar Avatar asked Feb 15 '17 08:02

Abhishek Gangwar


People also ask

How do I fix No module named in tensorflow?

The Python "ModuleNotFoundError: No module named 'tensorflow'" occurs when we forget to install the tensorflow module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install tensorflow command.


2 Answers

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.

like image 59
Dharma Avatar answered Sep 26 '22 06:09

Dharma


I had a more basic problem when I received this error.

The "Validate your installation" instructions say to type: python

However, I have both 2.7 and 3.6 installed. Because I used pip3 to install tensorflow, I needed to type: python3

Using the correct version, I could import the "tensorflow" module.

like image 20
Cryptc Avatar answered Sep 23 '22 06:09

Cryptc