M.E. Irizarry-Gelpí

Physics impostor. Mathematics interloper. Husband. Father.

TensorFlow via Conda


I just installed TensorFlow on my laptop. Since I use Conda and Anaconda, the installation process was a bit more complicated than what the TensorFlow website says. Here are the steps I followed.

First, create a new Python 3.4 environment:

$ conda create --name tensorflow python=3.4

This new environment is called tensorflow. Here is where I had trouble: I initially installed tried

$ conda create --name tensorflow python=3.4 anaconda

This install a bunch of extra packages, but then later the TensorFlow installation messes everything up.

After creating the tensorflow environment, change to that environment:

$ source activate tensorflow
(tensorflow)$ 

I get an error if I run the command on the TensorFlow website. What worked for me is to first download the file from the direct link, and then install it directly:

(tensorflow)$ pip install tensorflow-0.7.1-cp34-none-linux_x86_64.whl

Note that this command will install a version of TensorFlow (currently 0.7.1) that does not use GPUs. This solution was inspired by this discussion.

You can test your installation by running the following python script:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a + b))

You should see

Hello, TensorFlow!
42

Good luck!