Last answered:

28 Oct 2020

Posted on:

14 May 2020

1

Problem with TensorFlow2.0: ImportError: DLL load failed.

Dear Sir or Madam, With regard to module “3. Machine and Deep Learning” with course “Deep Learning with TensorFlow“ and subcourse “Introduction to TensorFlow”:

I can not start TensorFlow because of error:
ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.

I followed the instruction which you offered in you blog “How to install TensorFlow 2 in Anaconda” and the recommended link in error message for solution. Then I searched on internet after solution but I did not find any solution which would match to my problem. I really have zero clue, what I should do now.

The full error code:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59

~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>
27 return _mod
---> 28 _pywrap_tensorflow_internal = swig_import_helper()
29 del swig_import_helper

~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()
23 try:
---> 24 _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
25 finally:

~\anaconda3\lib\imp.py in load_module(name, file, filename, details)
241 else:
--> 242 return load_dynamic(name, filename, file)
243 elif type_ == PKG_DIRECTORY:

~\anaconda3\lib\imp.py in load_dynamic(name, path, file)
341 name=name, loader=loader, origin=path)
--> 342 return _load(spec)
343

ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
<ipython-input-1-966405710adb> in <module>
1 import numpy as np
2 import matplotlib.pyplot as plt
----> 3 import tensorflow as tf

~\anaconda3\lib\site-packages\tensorflow\__init__.py in <module>
39 import sys as _sys
40
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
43

~\anaconda3\lib\site-packages\tensorflow\python\__init__.py in <module>
48 import numpy as np
49
---> 50 from tensorflow.python import pywrap_tensorflow
51
52 # Protocol buffers

~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
67 for some common reasons and solutions. Include the entire stack trace
68 above this error message when asking for help.""" % traceback.format_exc()
---> 69 raise ImportError(msg)
70
71 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "C:\Users\Name\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Name\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Name\anaconda3\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\Name\anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Name\anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist fehlgeschlagen.


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.
  Thank you very much for your help.
3 answers ( 0 marked as helpful)
Instructor
Posted on:

21 May 2020

0
Hi Volkmar, Thanks for reaching out. DLL errors are not very easy to fix actually. They happen because of improper installation or some loss of data afterwards. I highly suggest that you completely reinstall the whole Anaconda distribution - that would be the easiest way to tackle the issue. Best, The 365 Team
Posted on:

16 Jun 2020

2
Hello 365 Team, two weeks ago I wrote a message, but it seem did not display. I reinstalled Anaconda but the issue is the same. I don't know what should I do? Have you any idea?
Best regard Volkmar Meiller
Posted on:

28 Oct 2020

2
Now, I found a solution. I downgarde the latest TensorFlow version to TensorFlow 2.0.   Open Anaconda "CMD.exe Prompt", then write "pip install tensorflow == 2.0".

Submit an answer