Guide to Install Tensorflow-GPU r1.8 on Windows PC

install tensorflow gpu 1.8 post front image

This tutorial is going to show you how to install tensorflow gpu version 1.8 on a computer with Windows operating system. I am going to demonstrate the install on a Windows 10 PC, but it will work fine with Windows 7 and Windows 8 as well. You can also follow my tutorial video on Youtube.

Foremost, please make sure that the GPU in your computer has CUDA Compute Capability greater than or equal to 3.0. You can check yours within the list of supported GPU’s in the official website of NVIDIA https://developer.nvidia.com/cuda-gpus

install tensorflow gpu gpu compute capability check

Before going for actual install Tensorflow GPU, you need to ensure the following pre-requisites in your PC:

  1. Install CUDA Toolkit 9.0 

    Go to the CUDA toolkit archive download page. Select Operating System as Windows. Select Version as per your Windows version. I have choosen 10. Then, opt for the download of exe(local) file. This will show up 3 installers: 1 base installer and 2 patches for the same.install tensorflow gpu cuda toolkit downloads

    Download the installers and install them one after the other starting from the base installer. The installation procedure is pretty straight forward. You just need to select “Express Installation”  and “Agree to Install”. Similarly, install the Patches 1 & 2.

    If your CUDA toolkit 9.0 installation fails, you can fix it using the steps given in this post.

  2. Install cuDNN 7.0 

    Download cuDNN 7.0.5 for CUDA 9.0 from cuDNN archive . Please note that you need to sign in with NVIDIA account before downloading. (Don’t worry you can sign up freely) Extract the zip file in a place of your convenience. Go to CUDA>>bin folder and copy the cudnn64_7.dll  file. Paste this file into your Installation Drive:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin.That’s it! You have added the functionality of cuDNN to CUDA toolkit.

Create Conda Environment

Now, you need to install the tensorflow-gpu v1.8 library. Proceeding further with the setup guide, I assume that you have Anaconda pre-installed in your PC, since we are going to install inside conda environment using pip.

So, now that you have GPU capable of deep learning and Anaconda installed. Quickly open up the Anaconda Command Prompt. You can simply type in “cmd” in the start bar, and you will see Anaconda Prompt if Anaconda is added to path.

Foremost, update the conda using command:

conda update conda

It will ask for permission to install necessary update packages, just permit it with a ‘Yes’.

Next, we are going to create a conda environment for the installation of tensorflow gpu. Conda environment helps ensure that the packages work optimally with their suitable and compatible libraries within enclosures, without interfering with other installations. For example, while installing tensorflow-gpu 1.8, meanwhile I am having tensorflow gpu 1.5 with Python 3.5 on a separate conda environment which will remain intact and untouched by this installation. I can work on deep learning with different versions by just switching the conda environments.

Conda environment being explained, create a new conda environment with Python 3.6 and pip package, by issuing the command:

conda create –n tf18 python=3.6 pip

Next, activate the newly created environment by issuing the command:

activate tf18activate tf18

After activation of the environment, the subsequent commands get accepted inside the tf18 environment.

Install Tensorflow GPU using pip

Once we are inside the environment, issue the pip command:

pip install --ignore-installed --upgrade tensorflow-gpupip install --ignore-installed --upgrade tensorflow-gpu

While executing the above command, make sure the PC is connected to the Internet, as pip will download latest tensorflow-gpu wheel files and other necessary installers.

Hence, the Tensorflow-GPU release 1.8 has been installed successfully.

Check the installation.

Quickly open up the python interpreter by typing in “Python”,

Let’s write the code to check tensorflow gpu version:

import tensorflow as tf
tf.__version__import tensorflow as tf tf.__version__

This should output ‘1.8.0’ on the console.

Now, let’s do a simple test code on tensorflow

hello=tf.constant(“hello world”)
with tf.Session() as sess:
     print(sess.run(hello))

This should print “hello world” in the console output as shown below.

Congratulations, Tensorflow-GPU r1.8 is working fine on your PC.

Thanks for reading this post. Cheers!!

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

12 − 12 =