1
votes

I am on a docker image, so I can not access the "outside" of the docker image. I want to install tensorflow with gpu support so used:

pip install tensorflow-gpu 

cudnn and CUDA is installed and working. An old version (0.11) is available in the image and is running with CUDA and cudnn just fine, but I need to upgrade to version 1 or higher. I have two Nvidia Titans.

After using the shown pip command I use the following script to see if I have GPU support enabled, and also look at nvidia-smi:

import tensorflow as tf


# Creates a graph.
with tf.device('/gpu:0'):
  a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
  b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
  c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print sess.run(c)

After this I only get the output

No module named tensorflow

If I check the pip list with:

pip list | grep tensorflow

I get the output:

tensorflow-gpu (1.0.1)

Is it a simple wrong import?

If I use the non-gpu-support install pip install tensorflow the above code gives:

Device mapping: no known devices.

Which of course is due to no support of the gpu. So to summarize, how do I get the GPU Version of tensorflow to work with a simple pip install and a version above 1.0 ?

2
I would check full install log of pip with pip install tensorflow-gpu --log - fedterzi
You definitely need the GPU version. The "no module" error seems to indicate that you might be using wrong version of python. Are you sure that pip you are using to install tensorflow is using the same python that you are running the code with? - Mad Wombat

2 Answers

2
votes

Installing it with

conda install tensorflow-gpu 

resolved all issues.

0
votes

Activate tensorflow with:

>>>source activate tensorflow