tensorflow: ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Nope
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 8.1
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: It didn’t happen on mobile
  • TensorFlow installed from (source or binary): I used pip
  • TensorFlow version (use command below): tensorflow==2.3.1
  • Python version: Python 3.8.2
  • Bazel version (if compiling from source): I didn’t use Bazel
  • GCC/Compiler version (if compiling from source): I did not compile it from source
  • CUDA/cuDNN version: I didn’t install tensorflow for GPU, just tensorflow
  • GPU model and memory: I don’t have one

Describe the current behavior The current behavior is that I try to import tensorflow using import tensorflow And I get

Traceback (most recent call last):
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dyna
mic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\python\__init__.py", line 40, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\python\eager\context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\python\pywrap_tfe.py", line 28, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\python\pywrap_tensorflow.py", line 83, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\M.Sahal\AppData\Roaming\Python\Python38\site-packages\tensorflo
w\python\pywrap_tensorflow.py", line 64, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dyna
mic link library (DLL) initialization routine failed.


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.

Describe the expected behavior I expected for it to load normally.

Standalone code to reproduce the issue import tensorflow

Other info / logs I tried to install the newest version of Microsoft Visual C++ but that didn’t solve it. I tried installing Keras too but that didn’t fix it either.

Stack overflow question: https://stackoverflow.com/questions/64282592/failed-to-load-the-native-tensorflow-runtime-windows-8-1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (6 by maintainers)

Most upvoted comments

No but I was due to get a new laptop, when I got my new laptop and installed tensorflow and the problem wasnt there