Archive for category Tensorflow

Tensorflow Error Cannot Find cudnn64_6.dll

I’m trying to dabble in Deep Learning – cause that’s a simple topic you can just dip your toes in right?  Ok well maybe I’m overly optimistic.  But I did run into an error this evening that threw me for a loop.  I’m sure I’ll see this error in a few months on my other machine and be baffled.  On that day I’ll google and hopefully find this post.

The Error:

Traceback (most recent call last):
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\platform\self_check.py", line 87, in preload_check
 ctypes.WinDLL(build_info.cudnn_dll_name)
 File "C:\Program Files\Python 3.5\lib\ctypes\__init__.py", line 347, in __init__
 self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File ".\helloworld\world.py", line 4, in <module>
 import tensorflow as tf
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
 from tensorflow.python import *
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
 from tensorflow.python import pywrap_tensorflow
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
 self_check.preload_check()
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\platform\self_check.py", line 97, in preload_check
 % (build_info.cudnn_dll_name, build_info.cudnn_version_number))
ImportError: Could not find 'cudnn64_6.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Note that installing cuDNN is a separate step from installing CUDA, and this DLL is often found in a different directory from the CUDA DLLs. You may install the necessary DLL by downloading cuDNN 6 from this URL: https://developer.nvidia.com/cudnn
D:\source\github.com\ssargent\ml\tensorflow\src [develop +1 ~0 -0 !]> python .\helloworld\world.py
Traceback (most recent call last):
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\platform\self_check.py", line 87, in preload_check
 ctypes.WinDLL(build_info.cudnn_dll_name)
 File "C:\Program Files\Python 3.5\lib\ctypes\__init__.py", line 347, in __init__
 self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
 File ".\helloworld\world.py", line 4, in <module>
 import tensorflow as tf
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
 from tensorflow.python import *
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
 from tensorflow.python import pywrap_tensorflow
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
 self_check.preload_check()
 File "C:\Program Files\Python 3.5\lib\site-packages\tensorflow\python\platform\self_check.py", line 97, in preload_check
 % (build_info.cudnn_dll_name, build_info.cudnn_version_number))
ImportError: Could not find 'cudnn64_6.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Note that installing cuDNN is a separate step from installing CUDA, and this DLL is often found in a different directory from the CUDA DLLs. You may install the necessary DLL by downloading cuDNN 6 from this URL: https://developer.nvidia.com/cudnn

In my case, I had run a simple hello world program using Tensorflow but found it ran slow.  I believe this is because I’m using the GPU version and its a hello world, if its not doing any real work then its likely faster to use the CPU.  However I figured an update may speed it up.  So after the update I ran the program again and got this error…  Oh shoot…

Well I should have read the message more clearly – this is clearly a #ScottFail.  I searched for cudnn64_6.dll but couldn’t find it.  I had cudnn64_5.dll but not the _6 version.  Googling was suprisingly unhelpful for this.

In my case here’s what this is saying: You have CUDNN 5.1 but you need CUDNN 6.0 – Go download that and try again.  After doing that I got this:

 python .\helloworld\world.py
b'Hello, Tensorflow'

It works!  So don’t be like me and be confused – or be like me an see this blog post.

Leave a comment