Install TensorFlow in Python

This tutorial tells how to install Tensorflow in the prebuilt configuration in both Windows 10 and Ubuntu 16.04(for both CPU & GPU)

Currently, 64-bit Python only supported Tensorflow.

Install CPU Version on Ubuntu & Windows

For Ubuntu 64bit OS

First Process is to install CPU Version of TensorFlow. CPU version is mostly recommended for Tensor Flow installation.

  1. Download the whi file from https://pypi.python.org/pypi/tensorflow
  2. Create a Virtual Path & Install the whi file
    1. For Python 2: pip2 install [whi file path]
    2. For Python 3: pip3 install [whi file path]
  3. Verify the Tensorflow installation:
$ python3
>>> import tensorflow as tf
>>> hello = tf.constant(‘Hello. Tensorflow!')
>>>sess=tf.Session()
>>>sess.run(hello)
‘Hello, TensorFlow!'
>>>a=tf.constant(10)
>>>b=tf.constant(32)
>>>sess.run ( a + b)
42
>>>sess.close()

For Windows-64bit OS:

CPU version is mostly recommended for Tensor Flow installation in Windows.

Step-1: Download the whi file from https://pypi.python.org/pypi/tensorflow

Tensorflow-1.7.0-cp35-cp35m-win_amd64.whi

Step-2: Installing the whi file:

Create a Virtual Path and install the respective whi files.

For python 2

pip2 install [whi file path]

For Python 3

pip3 install [whi file path]

Step-3: Verify the Tensorflow installation:

$python3
>>> import Tensorflow as tf
>>> hello = tf.constant(‘Hello. Tensorflow!')
>>>sess=tf.Session()
>>>sess.run(hello)
‘Hello, TensorFlow!'
>>>a=tf.constant(10)
>>>b=tf.constant(32)
>>>sess.run ( a + b)
42
>>>sess.close()

Installing GPU Version on TensorFlow for Ubuntu:

Install GPU Version on Ubuntu

GPU Version of Tensorflow is used to speed up the Training. GPU Version is the Advanced Version of the TensorFlow Installation.

Step-1: Update & Upgrade your system

Sudo apt-get update/upgrade

Step-2: Verify you have a CUDA-capable GPU and Linux Version.

Lspci | grep –I nvidia

Linux Version

Unam – m && cat /etc/*release

Step-3: Install Dependencies

Sudo apt-get install build-essential

Python 2.7-dev python3.5-dev build setup.

Step-4: Install Linux Kernel and download the NVIDIA CIA Toolkit for the Setup and Reboot the System for NVIDIA Driver

Step-5: Install cuDNN 7.1.2 and check the Kernel Version on Cmd Window.

Step-6: Install Dependencies on libcupti (required) and install the respective whi file in the above step and make the installation.

Install GPU Version on Windows

Step-1: Verify you have a CUDA-capable GPU and download the NVIDIA CUDA Toolkit.

Step-2: Reboot the System to load the NVIDIA drivers.

Step-3: Install cuDNN 7.1.2

Step-4: Download the Respective whi file and Install the whi file.

Step-5: Verify the Tensorflow Installation with the respective command as mention above lines for windows.

This is all you need to do to install Tensorflow GPU Version on Windows OS.

Follow the installation has both GPU and CPU version of  TensorFlow Value.

This tutorial tells how to install Tensorflow in the prebuilt configuration in both Windows 10 and Ubuntu 16.04.In which we are looking how to install Tensorflow CPU and GPU both for Ubuntu as well as Windows OS.We have to install the Tensorflow in the latest version. Currently, 64-bit Python only supported Tensorflow.

Leave a Reply