Um blog sobre nada

Um conjunto de inutilidades que podem vir a ser úteis

Installing tensorflow with GPU support on windows

Posted by Diego em Novembro 1, 2017

Installing tensorflow with GPU support on windows can be challenging. There are quite a few moving pieces and each one of those pieces have a specific version and will only work with that version. I spent a few hours trying to get that right, mainly because when I say that “cuda” was a dependency, the first thing I did was to install the latest version; Very soon I learned that it was not a good idea. So, if you are getting any of the errors bellow, this guide is for you.

This guide was written on October 2017, so the versions mentioned are related to that date.

ImportError: DLL load failed: The specified module could not be found.                   

ModuleNotFoundError: No module named ‘_pywrap_tensorflow_internal’

Failed to load the native TensorFlow runtime.

First of all, this script is your best friend during the process (TensorFlow on Windows self-check). It will show which pieces you are missing. Eventually this is what we are looking for:


I will go through the process but it all boils down to having the correct (matching) versions of tensorflow, CUDA and cuDNN (the last two being more problematic)

1)    Install Visual Studio:

I was trying this process on a brand new laptop so the first thing I had to do is install Visual Studio (I presume it is for the C++ compiler), which can be downloaded from here.

2)    Download the NVIDIA CUDA Toolkit (1.4 Gb):

Be careful, if you go to the CUDA downloads page ( you will end up downloading the most recent version (CUDA 9 at the moment), and tensorflow uses CUDA 8.

With CUDA 8 there will also be a data patchTo get CUDA 8, go to

FYI: I made the mistake of downloading and installing CUDA 9 before realizing 8 was the correct version so I ended up having two versions installed. I didn’t seem to have mattered but I did however get this message when installed version 8:



3)    Download cudNN

cuDNN is a wrapper of NVIDIA’s cuDNN library, which is an optimized library for CUDA containing various fast GPU implementations, such as for convolutional networks and RNN modules. (Installation guide:   

Here I made another mistake. I went straight to the frameworks page ( and clicked the link associated with tensorflow. That led me to download cuDNN v7 but tensorflow needs v5.1 (or 6).

The link you want is this:

And select version:

·       “cuDNN v5.1 (Jan 20, 2017), for CUDA 8.0” if you have tensorflow version <1.3

·       “cuDNN v6.0 (April 27, 2017), for CUDA 8.0”  if you have tensorflow version 1.3

               Then download and unzip the file and copy the files to the respective locations on the CUDA folder:

· bin\cudnn64_7.dll to \CUDA\v8.0\bin.

· nclude\cudnn.h to \CUDA\v8.0\include.

· lib\x64\cudnn.lib to  \CUDA\v8.0\lib\x64.


That should be enough to get you up and running.

Few other useful links:




Deixe uma Resposta

Preencha os seus detalhes abaixo ou clique num ícone para iniciar sessão:

Logótipo da

Está a comentar usando a sua conta Terminar Sessão /  Alterar )

Google+ photo

Está a comentar usando a sua conta Google+ Terminar Sessão /  Alterar )

Imagem do Twitter

Está a comentar usando a sua conta Twitter Terminar Sessão /  Alterar )

Facebook photo

Está a comentar usando a sua conta Facebook Terminar Sessão /  Alterar )

Connecting to %s

%d bloggers like this: