[Solved] Error caused by correspondence between tensorflow GPU version number and CUDA

Preface

perception: CUDA 8.0 + cudnn 6.0 + tensorflow 1.3

cuda 9.0+cudnn 7.0+TensorFlow 1.7

python3.6.2+cuda 9.0+cudnn7.5+Tensorflow 1.10.0+Anaconda4.6.11

Recently, the GPU version of tensorflow has been re installed on a new workstation. At the beginning, it was easy to update to the latest version 1.13, and then input the Hello tensorflow program. However, the error “importerror: DLL load failed: unable to find the specified module” was reported. In desperation, all kinds of Baidu, seeing an old blog, proposed to reduce tensorflow version to 1.4, so they first unloaded and then reloaded it. After a modification, they reported an error of “could not find ‘cudart64″_ 80.dll’. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit ”The tensorflow version I installed is too low to support cuda8.0, but I installed cuda9.0, So there is a mismatch. Later, I uninstall the current tensorflow environment and specify to install version 1.7. This is a record to prevent future generations from stepping on the pit less

The following figures are all command line operations

Tensorflow version is too low, CUDA version is too high

The specific errors are as follows:

(tensorflow-gpu) C:\Users\WW>python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line 75, in preload_check
    ctypes.WinDLL(build_info.cudart_dll_name)
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\ctypes\__init__.py", line 348, 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 "<stdin>", line 1, in <module>
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
    self_check.preload_check()
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\platform\self_check.py", line 82, in preload_check
    % (build_info.cudart_dll_name, build_info.cuda_version_number))
ImportError: Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

Tensorflow version is too high, CUDA version is too low

The specific errors are as follows:

(tensorflow-gpu) C:\Users\WW>python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "D:\TensorFlow\Anaconda\Anaconda\envs\tensorflow-gpu\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

Correspondence between tensorflow and CUDA version

Attached are several forms:

For the latest version, please refer to tensorflow Chinese website: https://www.tensorflow.org/install/source#tested_source_configurations

Summary

Installation environment reference blog must pay attention to time, time, time. Maybe it could have been done at that time. Now it’s not necessarily OK. The version problem is really annoying

Don’t be greedy, update to the latest version, understand clearly in advance, and then install the corresponding version

Similar Posts: