Installing TensorFlow GPU Version on Windows

TensorFlow 1.4 installation on Windows is still not as straightforward so here are quick steps:

  1. Install Anaconda. Grab the version that has Python 3.6. After installation, you will need to downgrade to Python 3.5 as quite a few libraries like OpenCV still aren't compatible with Python 3.6 and also TensorFlow does seem to have few issues with 3.6. So after installing Anaconda run following command to downgrade:
    conda install python=3.5

    . Another alternative is to create virtual environment but I want to keep this post short.

  2. Next, install NVidia CUDA Toolkit 8.0. This is currently not the version so you can only find in archives and you might have to register on NVidia website first. You will see Base Installer and Patch 2. Install both in one after another. Note that you must do this after step 1. If you did this before then go to Environment Path editor and make sure NVidia Cuda Toolkit's path is listed before Anaconda path. Currently Anaconda also supplies CUDA 8.0 DLLs and they don't seem to be compatible causing DLL ImportError.
  3. Next, Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0. Extract the zip file to some folder and add path path cuDNN6\cuda\bin in to your machine's Environment Path. Make sure this path comes before Anaconda's path in your Environment Path variable. TensorFlow 1.4.0 looks for cuDNN64_6.dll and this folder has this DLL. Again this step should be done after step 1 otherwise Anaconda's cuDNN DLL will be found first on path and you will get DLL ImportError.
  4. Open Command Prompt as Administrator and install TensorFlow using command:
    pip install --ignore-installed --upgrade tensorflow-gpu

    . Sometime this command might fail. In which case, try to update pip (if you see warning) and run this command again.

  5. Validate your installation.

If you are getting ImportError for DLL load then see my post on how to debug it.

Leave a Reply