0
votes

import tensorflow as tf Traceback (most recent call last): File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "E:\path\envs\py36_tf_cpu\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 "E:\path\envs\py36_tf_cpu\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "E:\path\envs\py36_tf_cpu\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow__init__.py", line 22, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow\python__init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "E:\path\envs\py36_tf_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "E:\path\envs\py36_tf_cpu\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 "E:\path\envs\py36_tf_cpu\lib\imp.py", line 243, in load_module return load_dynamic(name, filename, file) File "E:\path\envs\py36_tf_cpu\lib\imp.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

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

1

1 Answers

0
votes

As of April 2019, I solved the "DLL load failed" problem under Windows 10 / Python 3.6.x / GPU RTX 20xx by installing CUDA 10.0 (not 10.1 or 9.x!!!) with cuDNN 7.5.0. I also have Visual Studio 2015 installed.

If you have CUDA 10.1, uninstall it, install 10.0, and reboot. Place the files from cuDNN in the respective dirs of your CUDA installation. Don't forget to add the location of your cuDNN *.dll files (the /bin/ folder of your CUDA installation) to your PATH.

Tensorflow can be installed using pip install tensorflow-gpu (currently version 1.13.1).

You can test if the GPU is registered, using:

import tensorflow as tf
import keras

config = tf.ConfigProto( device_count = {'GPU': 1 , 'CPU': 56} ) 
sess = tf.Session(config=config) 
keras.backend.set_session(sess)