0
votes

I installed Tensorflow 1.9.0 from source code.

  1. I create new env use conda:

conda create -n tensorflow python=2.7

  1. I create tensorflow-1.9.0rc0-cp27-cp27mu-linux_x86_64.whl file successfully in the dir: /tmp/tensorflow_pkg/, following the tutorial on official web.
  2. I use pip to install the .whl file in the tensorflow evn:

source activate tensorflow

pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc0-cp27-cp27mu-linux_x86_64.whl

  1. I got the successful message:

(tensorflow) usename@lab:$ pip install /tmp/tensorflow_pkg/tensorflow-1.9.0rc0-cp27-cp27mu-linux_x86_64.whl Processing /tmp/tensorflow_pkg/tensorflow-1.9.0rc0-cp27-cp27mu-linux_x86_64.whl Requirement already satisfied: protobuf>=3.4.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (3.6.0) Requirement already satisfied: astor>=0.6.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (0.6.2) Requirement already satisfied: backports.weakref>=1.0rc1 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.0.post1) Requirement already satisfied: setuptools<=39.1.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (39.1.0) Requirement already satisfied: wheel in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (0.31.1) Requirement already satisfied: mock>=2.0.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (2.0.0) Requirement already satisfied: enum34>=1.1.6 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.1.6) Requirement already satisfied: gast>=0.2.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (0.2.0) Requirement already satisfied: termcolor>=1.1.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.1.0) Requirement already satisfied: absl-py>=0.1.6 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (0.2.2) Requirement already satisfied: six>=1.10.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.11.0) Requirement already satisfied: tensorboard<1.9.0,>=1.8.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.8.0) Requirement already satisfied: grpcio>=1.8.6 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.12.1) Requirement already satisfied: numpy>=1.13.3 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorflow==1.9.0rc0) (1.14.5) Requirement already satisfied: funcsigs>=1; python_version < "3.3" in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow==1.9.0rc0) (1.0.2) Requirement already satisfied: pbr>=0.11 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from mock>=2.0.0->tensorflow==1.9.0rc0) (4.0.4) Requirement already satisfied: bleach==1.5.0 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.9.0rc0) (1.5.0) Requirement already satisfied: futures>=3.1.1; python_version < "3" in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.9.0rc0) (3.2.0) Requirement already satisfied: markdown>=2.6.8 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.9.0rc0) (2.6.11) Requirement already satisfied: werkzeug>=0.11.10 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.9.0rc0) (0.14.1) Requirement already satisfied: html5lib==0.9999999 in /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.9.0rc0) (0.9999999) Installing collected packages: tensorflow Successfully installed tensorflow-1.9.0rc0

  1. but I got the Error : ** No module named tensorflow** :

Python 2.7.15 |Anaconda custom (64-bit)| (default, May 1 2018, 23:32:55) [GCC 7.2.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

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

  1. pip show tensorflow

(tensorflow) usename@lab:$ pip show tensorflow Name: tensorflow Version: 1.9.0rc0 Summary: TensorFlow is an open source machine learning framework for everyone. Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: [email protected] License: Apache 2.0 Location: /home/csf/anaconda2/envs/tensorflow/lib/python2.7/site-packages Requires: protobuf, astor, backports.weakref, setuptools, wheel, mock, enum34, gast, termcolor, absl-py, six, tensorboard, grpcio, numpy Required-by:

So, why can I import tensorflow ? Thank you in advance!

Ubuntu 16.04 cuda:9.1 cudnn:7.0.5

2

2 Answers

0
votes

Did you make sure to install with pip 2.7? If you didn't specify it might have installed a for a newer version of python, thus causing the expected 2.7 module to not exist.

0
votes

In anaconda you can use anaconda navigator to install packages. Just go to Environment and root and select "Not installed" on the drop down box. From there you can select tensorflow and install it. I suppose that judging by the date you probably don't need this any more but maybe someone else could use the info.