Tensorflow (1.13.1) Exception when import: DLL load failed (Windows 10)

Sophia S.

I have installed Python 3.7.3 on my Windows 10 machine. Afterwards I downloaded with the tensorflow module: pip install https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.13.1-cp37-cp37m-win_amd64.whl

On the computer is Visual Studio 2019 installed with additional MSVC v141 (VS 2017) and MSVC v140 (VS 2015).

When I run import tensorflow as tf in python, I get the following error:

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

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\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\foo\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\foo\AppData\Local\Programs\Python\Python37\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.

I have tested some solutions from other answers, but nothing has solved my problem. Does anyone have an idea?


Edit: The reason was that my CPU has no AVX support. Now it works.

mlneural03

TensorFlow release binaries version 1.6 and higher are prebuilt with AVX instruction sets.

Therefore on any CPU that does not have these instruction sets, either CPU or GPU version of TF will fail to load.
Apparently, your CPU model does not support AVX instruction sets. You can still use TensorFlow with the alternatives given below:

  • Try Google Colab to use TensorFlow.
    The easiest way to use TF will be to switch to google colab.You get pre-installed latest stable TF version. Also you can use pip install to install any other preferred TF version.
    It has an added advantage since you can you easily switch to different hardware accelerators (cpu, gpu, tpu) as per the task. All you need is a good internet connection and you are all set.
  • Try to build TF from sources by changing CPU optimization flags.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

python tensorflow import dll load failed

From Dev

"ImportError: DLL load failed" when importing tensorflow

From Dev

Failed to Load DLL After Windows 10 Upgrade

From Dev

Python Opencv DLL load failed - Windows 10

From Dev

import _ssl error,DLL load failed ,Python 37 Anaconda Windows 10

From Dev

Getting the error "DLL load failed: The specified module could not be found." while trying to import tensorflow for Windows in Anaconda using PyCharm

From Dev

Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found

From

"DLL load failed" when import cv2 (opencv)

From Dev

DLL load failed when importing TensorFlow with GPU support

From Dev

DLL load failed: the specified module could not be found Windows 10 shell

From Dev

DLL load failed: %1 is not a valid Win32 application - Appcelerator

From Dev

paramiko ImportError: DLL load failed: The operating system cannot run %1

From Dev

Python: DLL load failed: %1 is not a valid Win32 application

From Dev

ImportError: DLL load failed: The specified module could not be found. While attempting to import TensorFlow

From Dev

Tensorflow installation on Windows: DLL load failed while importing _pywrap_tensorflow_internal

From Dev

Can't import Orekit - 'DLL load failed'

From Dev

windows vim ":py import socket" returns "load dll failed: method not found"

From Dev

Error "Module XYZ.dll failed to load" when using Regsvr32 to register a DLL on Windows 7

From Java

ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

From Dev

Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found

From Dev

Import Error: DLL load failed: The specified module could not be found when using cxfreeze

From Dev

Compile NumPy with MKL on Windows - DLL load failed

From Dev

Cannot load dll assembly in windows 10 (Exception from HRESULT: 0x80131515)

From Dev

Unable to import tensorflow - Failed to load native tensorflow runtime

From Java

Solving "DLL load failed: %1 is not a valid Win32 application." for Pygame

From Dev

python cython ImportError: DLL load failed: %1 is not a valid Win32 application

From Dev

ImportError: DLL load failed: %1 is not a valid Win32 application for _imaging module

From Dev

DLL load failed: The specified module could not be found. File "<stdin>", line 1, in <module>

From Dev

cx-freeze "ImportError: DLL load failed: %1 is not a valid Win32 application"

Related Related

  1. 1

    python tensorflow import dll load failed

  2. 2

    "ImportError: DLL load failed" when importing tensorflow

  3. 3

    Failed to Load DLL After Windows 10 Upgrade

  4. 4

    Python Opencv DLL load failed - Windows 10

  5. 5

    import _ssl error,DLL load failed ,Python 37 Anaconda Windows 10

  6. 6

    Getting the error "DLL load failed: The specified module could not be found." while trying to import tensorflow for Windows in Anaconda using PyCharm

  7. 7

    Tensorflow on windows - ImportError: DLL load failed: The specified module could not be found

  8. 8

    "DLL load failed" when import cv2 (opencv)

  9. 9

    DLL load failed when importing TensorFlow with GPU support

  10. 10

    DLL load failed: the specified module could not be found Windows 10 shell

  11. 11

    DLL load failed: %1 is not a valid Win32 application - Appcelerator

  12. 12

    paramiko ImportError: DLL load failed: The operating system cannot run %1

  13. 13

    Python: DLL load failed: %1 is not a valid Win32 application

  14. 14

    ImportError: DLL load failed: The specified module could not be found. While attempting to import TensorFlow

  15. 15

    Tensorflow installation on Windows: DLL load failed while importing _pywrap_tensorflow_internal

  16. 16

    Can't import Orekit - 'DLL load failed'

  17. 17

    windows vim ":py import socket" returns "load dll failed: method not found"

  18. 18

    Error "Module XYZ.dll failed to load" when using Regsvr32 to register a DLL on Windows 7

  19. 19

    ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

  20. 20

    Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found

  21. 21

    Import Error: DLL load failed: The specified module could not be found when using cxfreeze

  22. 22

    Compile NumPy with MKL on Windows - DLL load failed

  23. 23

    Cannot load dll assembly in windows 10 (Exception from HRESULT: 0x80131515)

  24. 24

    Unable to import tensorflow - Failed to load native tensorflow runtime

  25. 25

    Solving "DLL load failed: %1 is not a valid Win32 application." for Pygame

  26. 26

    python cython ImportError: DLL load failed: %1 is not a valid Win32 application

  27. 27

    ImportError: DLL load failed: %1 is not a valid Win32 application for _imaging module

  28. 28

    DLL load failed: The specified module could not be found. File "<stdin>", line 1, in <module>

  29. 29

    cx-freeze "ImportError: DLL load failed: %1 is not a valid Win32 application"

HotTag

Archive