/ TensorFlow

Installing TensorFlow on Windows 10

TensorFlow is an open source software library for machine intelligence and numerical computation using data flow graphs.

TensorFlow™ is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them. The flexible architecture allows you to deploy computation to one or more CPUs or GPUs in a desktop, server, or mobile device with a single API. TensorFlow was originally developed by researchers and engineers working on the Google Brain Team within Google's Machine Intelligence research organization for the purposes of conducting machine learning and deep neural networks research, but the system is general enough to be applicable in a wide variety of other domains as well.

This tutorial will help you install TensorFlow for CPU only, using native pip. Please ensure that you have installed the latest release of Python 3

Step 1: Install pip

Python 3.4 and above comes with pip3 installed out of the box, to check if you have pip3 run the following

> pip3 freeze

If this command returns something like this, then pip is installed and you can move to step 2

> pip3 freeze

Else, we need to install pip3, which will be used as the packet manager for TensorFlow and its dependencies. Download get-pip.py to a folder on your computer. Open a command prompt window and navigate to the folder containing get-pip.py. Then run the following

python get-pip.py

This will install pip

Note, if python 3 is not the only version installed, you have to use python3 instead of python in the commands

Step 2: Installing and setting up virtualenv

Install virtualenv using

> pip3 install virtualenv

To create a virtual environment for your tensorflow installation run where python, this will give you the path to your python installation
Navigate to your project directory
and run the following

> virtualenv --python="path_to_python" tensorflow

To activate your virtual environment run

> tensorflow\Scripts\Activate

You will see something like this (tensorflow) K:\Project\tensorflow>
this (tensorflow) indicates that you are in a virtual environment

To exit virtualenv just run deactivate

Step 3: Installing tensorflow

Execute the following command in your virtualenv

(tensorflow) H:\Cobalt\tensorflow>pip3 install --upgrade tensorflow
Collecting tensorflow
  Downloading tensorflow-1.2.1-cp35-cp35m-win_amd64.whl (21.2MB)
    100% |################################| 21.2MB 52kB/s

Successfully installed backports.weakref-1.0rc1 bleach-1.5.0 html5lib-0.9999999 markdown-2.6.8 numpy-1.13.1 protobuf-3.3.0 six-1.10.0 tensorflow-1.2.1 werkzeug-0.12.2

(tensorflow) H:\Cobalt\tensorflow>


Step 4: Test Installation

In your virtualenv, Invoke python by running python in your command shell

(tensorflow) H:\Cobalt\tensorflow>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Enter the following short program inside the python interactive shell:

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

If the system outputs the following, then you are ready to begin writing TensorFlow programs:

b'Hello, TensorFlow!'

If at all you see a warning/warnings like

c:\tf_jenkins\home\workspace\release-win\m\windows\py\35\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.

You need not worry about this. It does no harm and you can use your tensorflow installation without any problem.