Tensorflow GPU version installation Guide

Install Tensorflow GPU version on Windows 10 (Anaconda Virtual Envrionment)

I recently updated this post for the latest version of Tensorflow 1.9.0.

Requirements to run TensorFlow with GPU support

  • GPU card with CUDA Compute Capability 3.0 or higher
  • CUDA® Toolkit 9.0
  • The NVIDIA drivers associated with CUDA Toolkit 9.0
  • cuDNN v7.1.4

    Check GPU card

    See NVIDIA documentation for a list of supported GPU cards.

Install CUDA® Toolkit 9.0

Download at https://developer.nvidia.com/cuda-downloads
Select your target platform and I recommend local type installer (network installer is slower). platform platform

Install cuDNN v7.1.4

Download at https://developer.nvidia.com/rdp/cudnn-download. You need to sign in to download cuDNN (it’s free).

cuDNN

Select your platform to download cuDNN(.zip). Then, unzip and move them to correct CUDA directory. In my case,

  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib

Setting up Anaconda Virtual Environment

To use Tensorflow GPU version on Windows, We will create an Anaconda Virtual Environment.
If you already have Anaconda, you don’t have to re-install Anaconda for python 3.5.x version. I used Anaconda 4.3.1 (python 2.7.6 64-bit version).

If you don’t have any Anaconda, Download at www.continuum.io

Create Virtual Environment

run CMD console, and type following command

C:\WORKING-PATH>conda create -n tensorflow python=3.5 anaconda

Your virtual envrionment named ‘tensorflow’ will be installed with python 3.5.x version and anaconda.

Activate virtual environment

C:\WORKING-PATH>activate tensorflow

You can see

(tensorflow) C:\WORKING-PATH> 

Install tensorflow

Install tensorflow with pip. Tensorflow only supports python 3.5.x version on Windows.

(tensorflow) C:\WORKING-PATH>pip install --upgrade tensorflow-gpu

Validate installation

(tensorflow) C:\WORKING-PATH>python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))

If the Python program outputs the following, then the installation is successful

Hello, TensorFlow!

You can see other tensorflow installation options at www.tensorflow.org

Enjoy with Tensorflow !!

Written on August 1, 2018