How to Install Tensorflow-GPU version with Jupyter (Windows 10) in 8 easy steps.

Vivek Singh
4 min readSep 19, 2017

--

Bonus: Comes with a basic “hello tensorflow” code in the end.

Prerequisites:

  1. Windows 10 OS :P
  2. Machine with CUDA supported GPU : Find list here.

Why should I install GPU version ?

If you have a GPU, why not use it.

More Formally, in the words of Google, “TensorFlow programs typically run significantly faster on a GPU than on a CPU. Therefore, if your system has a NVIDIA® GPU and you need to run performance-critical applications, you should ultimately install the GPU version”.

1 ) Check if your GPU is supported

Steps:

i) Go to command prompt-> windows+r->cmd->enter

ii) Paste the command & enter: wmic path win32_VideoController get name

iii) Go to this link to find out supported GPU.

If the name of your GPU is present, then you can install GPU supported tensorflow.

2) Install Anaconda

We will be needing to use Anaconda to awaken “Jupyter Notebook” and the dependencies of tensorflow.

Steps:

i) Download and install the latest Anaconda installer from here

3)Set up your Nvidia GPU

You need to install Cuda Toolkit 8.0 and cuDNN v5.1 as the GPU version works best with these.

Download and install CUDA Toolkit
Toolkit version 8.0 or above: https://developer.nvidia.com/cuda-downloads
Example installation directory: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0

Download and install cuDNN
You would need to signup at Nvidia in order to download these files.

After signing up, login to your account.

Download cuDNN version 7 library for Windows 10:

Now extract the cuDNN files into your Toolkit directory.

Very Important: Check for the Environment variables

Steps:

i) Hit windows+s -> Search for “Environment Variables”

Check if your CUDA_HOME, CUDA_PATH & CUDA_PATH_V8 is set up properly. If not add it.

ii) Check if your PATH variable has all of the highlighted components. If not, add them.

5) Start Tensorflow

Create conda environment
Create new environment, with the name tensorflow-gpu and python version 3.5.2

Steps:

i) Go to Anaconda command prompt (search for Anaconda in windows+s)

ii)Paste the command : conda create -n tensorflow-gpu python=3.5.2

Hit “Y” when asked

Activate the environment activate tensorflow-gpu

Install tensorFlow
pip install tensorflow-gpu

That’s it.

Now, tensorflow GPU is successfully installed in your machine.

Before proceeding further, let us check if our installation is correct, and the GPU is correctly mapped.

6) Check your tensorflow-gpu installation

i) Activate environment we created
activate tensorflow-gpu

ii) Test GPU
Enter into python shell
python

import tensorflow as tf

Now run this command and check if it identifies your GPU.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))

7) Install Jupyter notebook

Even if you already have Jupyter, you need to do this to map tensorflow into it.

i) Install Jupyter Notebook

pip install jupyter Notebook

ii) Install Pandas. It will help you in development

iii) Start your Notebook

Go to the link given to access your notebook.

8) Run a Hello world program

Enter the following commands in notebook cell:

import tensorflow as tf

hello=tf.constant('Hello,TensorFlow!')

sess=tf.Session()

print(sess.run(hello))

Hurray ! you have successfully installed GPU supported tensorflow and executed tensorflow command in your Jupyter Notebook

Happy Coding …………. :)

--

--

Vivek Singh
Vivek Singh

Responses (15)