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

ImportError: Traceback (most recent call last):
File “c:\Users\Imran\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 60, 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 Build and install error messages  |  TensorFlow for some common causes and solutions.
If you need help, create an issue at Issues · tensorflow/tensorflow · GitHub and include the entire stack trace above this error message.

@Abc_Efg ,

Welcome to the Tensorflow Forum!

Have you installed the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019 ?

If not, please install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019. because starting from the TensorFlow 2.1.0 version, the msvcp140_1.dll file is required from this package (which may not be provided from older redistributable packages). The redistributable comes with Visual Studio 2019 but can be installed separately:

  1. Go to the Microsoft Visual C++ downloads .
  2. Scroll down the page to the Visual Studio 2015, 2017 and 2019 section.
  3. Download and install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 for your platform.

Make sure long paths are enabled on Windows.

Thank you!