Kream
Kream

Reputation: 131

How to fix 'ImportError: DLL load failed: The specified procedure could not be found.' while importing tensorflow-gpu?

I cannot import tensorflow-gpu==1.13.1 on python 3.6.0.

What i have already done:

  1. Nvidia's drivers (i have GEFORCE 840M which is cuda supported with compute capability 5.0).

  2. I installed Visual Studio 2017 Professional (did not select any specifications in workload).

  3. I installed CUDA 10.1 (was having issues with Visual studio integration so i disabled it during the installation).

  4. I pasted Cudnn 7.5.0 onto cuda's folders.

  5. Restarted.

  6. Pip installed tensorflow-gpu==1.13.1 on python 3.6.0.

  7. but then i cannot import tensorflow at all it shows the error below.

>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\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\BenBouali\AppData\Local\Programs\Python\Python36\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\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 "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\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\BenBouali\AppData\Local\Programs\Python\Python36\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\BenBouali\AppData\Local\Programs\Python\Python36\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.
>>>

Goal: Obviously being able to import tensorflow and to import keras from the tensorflow library.

Upvotes: 0

Views: 1242

Answers (1)

grizzly
grizzly

Reputation: 1156

In my case this was an issue with detecting the correct CUDA Toolkit/cuDNN version with tensorflow-gpu==1.13.1.

After spending 2 hours on this I installed CUDA Toolkit 10.0 and set TF_CUDA_VERSION environment variable explicitly to 10 in the user env settings (Windows 10).

Upvotes: 1

Related Questions