jjc
jjc

Reputation: 33

Tensorflow - ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed

I am struggling to utilise TensorFlow within Jupyter notebook. I have installed TensorFlow via Anaconda Prompt (running as admin). But when I go to call it in my notebook I get the following error string (sorry this is long).

Any help or thoughts would be welcomed here - should I run a full uninstall and try again?

kind regards Jack

I am running:

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

The error message is as follows (there are a number of others but this is the first and the rest have similar issue):

Traceback (most recent call last): File "C:\Users\jjcon\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\jjcon\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\jjcon\Anaconda3\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "C:\Users\jjcon\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "C:\Users\jjcon\Anaconda3\lib\imp.py", line 342, 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:

Upvotes: 2

Views: 4953

Answers (1)

user11530462
user11530462

Reputation:

You have to install the Microsoft Visual C++ 2015-2019 Redistributable (x64) from here.

If you are facing any other issues possible reasons are

  • Your CPU does not support AVX2 instructions
  • Your CPU/Python is on 32 bits
  • There is a library that is in a different location/not installed on your system that cannot be loaded.

Please refer tested build configurations for windows CPU and GPU.

Upvotes: 1

Related Questions