Skip to content

DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed. During handling of the above exception, another exception occurred: #98640

@shoaib-niazi

Description

@shoaib-niazi

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

2.19

Custom code

Yes

OS platform and distribution

windows 11 pro

Mobile device

windows 11 pro

Python version

3.12.5

Bazel version

using jupyter notebook

GCC/compiler version

recebtally installed

CUDA/cuDNN version

No response

GPU model and memory

using cpu

Current behavior?


ImportError Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py:73
72 try:
---> 73 from tensorflow.python._pywrap_tensorflow_internal import *
74 # This try catch logic is because there is no bazel equivalent for py_extension.
75 # Externally in opensource we must enable exceptions to load the shared object
76 # by exposing the PyInit symbols with pybind. This error will only be
77 # caught internally or if someone changes the name of the target _pywrap_tensorflow_internal.
78
79 # This logic is used in other internal projects using py_extension.

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

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
Cell In[9], line 2
1 # as our dataset has been created so now apply a Sequential Neural network
----> 2 import tensorflow as tf
3 from tensorflow import keras
4 from tensorflow.keras.models import Sequential

File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow_init_.py:40
37 _os.environ.setdefault("ENABLE_RUNTIME_UPTIME_TELEMETRY", "1")
39 # Do not remove this line; See #42596
---> 40 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow # pylint: disable=unused-import
41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import KerasLazyLoader as _KerasLazyLoader

File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py:88
86 sys.setdlopenflags(_default_dlopen_flags)
87 except ImportError:
---> 88 raise ImportError(
89 f'{traceback.format_exc()}'
90 f'\n\nFailed to load the native TensorFlow runtime.\n'
91 f'See https://www.tensorflow.org/install/errors '
92 f'for some common causes and solutions.\n'
93 f'If you need help, create an issue '
94 f'at https://github.com/tensorflow/tensorflow/issues '
95 f'and include the entire stack trace above this error message.')
97 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "C:\Users\SHOAIB NIAZI\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.

Standalone code to reproduce the issue

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py:73
     72 try:
---> 73   from tensorflow.python._pywrap_tensorflow_internal import *
     74 # This try catch logic is because there is no bazel equivalent for py_extension.
     75 # Externally in opensource we must enable exceptions to load the shared object
     76 # by exposing the PyInit symbols with pybind. This error will only be
     77 # caught internally or if someone changes the name of the target _pywrap_tensorflow_internal.
     78 
     79 # This logic is used in other internal projects using py_extension.

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

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
Cell In[9], line 2
      1 # as our dataset has been created so now apply a Sequential Neural network
----> 2 import tensorflow as tf
      3 from tensorflow import keras
      4 from tensorflow.keras.models import Sequential

File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow\__init__.py:40
     37 _os.environ.setdefault("ENABLE_RUNTIME_UPTIME_TELEMETRY", "1")
     39 # Do not remove this line; See https://github.com/tensorflow/tensorflow/issues/42596
---> 40 from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow  # pylint: disable=unused-import
     41 from tensorflow.python.tools import module_util as _module_util
     42 from tensorflow.python.util.lazy_loader import KerasLazyLoader as _KerasLazyLoader

File ~\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py:88
     86     sys.setdlopenflags(_default_dlopen_flags)
     87 except ImportError:
---> 88   raise ImportError(
     89       f'{traceback.format_exc()}'
     90       f'\n\nFailed to load the native TensorFlow runtime.\n'
     91       f'See https://www.tensorflow.org/install/errors '
     92       f'for some common causes and solutions.\n'
     93       f'If you need help, create an issue '
     94       f'at https://github.com/tensorflow/tensorflow/issues '
     95       f'and include the entire stack trace above this error message.')
     97 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
  File "C:\Users\SHOAIB NIAZI\AppData\Roaming\Python\Python312\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.


Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.

Relevant log output

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions