//How to install Tensor Flow on Ubuntu

How to install Tensor Flow on Ubuntu

How to install Tensor Flow (deep learning software library) on Ubuntu (Debian based systems). These instructions were used to install on Lubuntu 16.04 LTS using Python 2.7.

First step is to install the following python libraries.


> apt-get install python-pip python-dev python-virtualenv

A virtual environment is used to install Tensor Flow. Create the virtual environment using the command below.


> virtualenv --system-site-packages ~/tensorflow

The next command activates the virtual environment. This will change your prompt to (tensorflow)$.


> source ~/tensorflow/bin/activate # bash, sh, ksh, or zsh

To deactivate the virtual environment use command deactivate.


(tensorflow)$ deactivate

Install Tensor Flow in active environment.


> (tensorflow)$ pip install --upgrade tensorflow

To test the install run the following code.


$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

All being well Tensor Flow should be successfully installed.