ImportError: no module named tensorflow

Please help me with this error.

I installed tensorflow module on my server and below is the 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: opensource@google.com 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 shadoworflow, I get the 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 follows

 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 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

+42
source share
16 answers

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

 pip install tensorflow==1.2.0 --ignore-installed 

I solved this problem with this command.

+24
source

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

Verify your installation instructions say to print: python

However, I have both 2.7 and 3.6 installed. Since I used pip3 to set the tensor flow, I needed to type: python3

Using the correct version, I can import the tensorflow module.

+20
source

Check if Tensorflow has been installed successfully using:

  pip3 show tensorflow 

If you get something like

 Name: tensorflow Version: 1.2.1 Summary: TensorFlow helps the tensors flow Home-page: http://tensorflow.org/ Author: Google Inc. Author-email: opensource@google.com License: Apache 2.0 Location: /usr/local/lib/python3.5/dist-packages Requires: bleach, markdown, html5lib, backports.weakref, werkzeug, numpy, protobuf, wheel, six 

You can try adding a path to your tensor flow location:

 export PYTHONPATH=/your/tensorflow/path:$PYTHONPATH. 
+16
source

For Anaconda3, just install in Anaconda Navigator: enter image description here

+13
source

Try installing shadoworflow on the user's site. This setting only works for you.

pip install tensorflow --user

+8
source

You may need this, as the first one may not work.

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl

+5
source

with python2

pip show tensorflow to verify installation

python test.py to run the test

with python3

pip3 show tensorflow to verify installation

python3 test.py to run the test

test.py

 import tensorflow as tf import numpy as np c = np.array([[3.,4], [5.,6], [6.,7]]) step = tf.reduce_mean(c, 1) with tf.Session() as sess: print(sess.run(step)) 

Or, if you have not set the flow tensor yet, try the white paper

+4
source

You can try this:

 $conda install -c conda-forge tensorflow 
+2
source

I tried to install tenorflow GPU for Windows 7 with pip3 for python3.5.x. Instead of doing pip3 install --upgrade tensorflow I just did pip install tensorflow , and after it was completed, I was finally able to import shadoworflow into python3.5.x.

+1
source

Instead of using the doc command ( conda create -n tensorflow pip python=2.7 # or python=3.3, etc. ), which wanted to install python2.7 in the conda environment, and continued to fail, saying that the module cannot be found during the installation verification steps, I used conda create -n tensorflow pip python=3 to make sure python3 was installed in the environment.

In doing this, I had to enter python instead of python3 when checking the installation, and the error python3 away.

+1
source

Try the steps to install Anaconda from TensorFlow docs.

0
source

Activate the virtualenv environment by running one of the following commands:

$ source ~ / tensorflow / bin / activate # bash, sh, ksh or zsh
$ source ~ / tensorflow / bin / activate.csh # csh or tcsh

Hope for this help

0
source

This worked for me:

 $ sudo easy_install pip $ sudo easy_install --upgrade six $ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl $ sudo pip install --upgrade $TF_BINARY_URL 
0
source

I had exactly the same problem. This is because by default Python in version 2 you need to make a link to version 3.

 >sudo rm -rf /usr/bin/python >sudo ln -s /usr/bin/python3.5 /usr/bin/python 

python links

0
source

I ran into the same problem. I just updated my command to start with python3 instead of python , and it worked perfectly.

0
source

In my case, I install 32 Bit Python , so I can not install Tensorflow. After uninstalling 32 Bit Python and installing 64 Bit Python I can successfully install tenorflow.

After reinstalling Python 64 bit you must verify that the path to the Python installation folder in the Windows Environment Path is correct.

You can check the version of Python by typing python in cmd.

0
source

Source: https://habr.com/ru/post/1264229/


All Articles