简体   繁体   中英

How to fix "Failed to load the native TensorFlow runtime." error when attempting running on gpu?

I've been running my tensorflow programs on my CPU. However, it's been getting slow, so I wanted to set up a gpu environment to run it on my 1070ti. However, when after downloading CUDA 9.0 and CUDNN 7.4, tensorflow-gpu has trouble running it.

The error appears whenever I try importing tensorflow in python. I have tensorflow installed in a virtualenv environment, and the script running is inside the folder.

import tensorflow

I get the following output:

Traceback (most recent call last):
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\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 "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 343, 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 "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\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 "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\Jimmy\Documents\machinelearning\machinelearning\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: The specified module could not be found.

According to this thread , these packages don't work on Windows 10:

  • Tensorflow 1.12.0
  • Cuda toolkit 10.0.130
  • cudnn 7.4.1.5

However, someone said that you can try to downgrade Tensorflow to version 1.10 using pip:

pip install tensorflow-gpu==1.10.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM