Ankur Bansal
Ankur Bansal

Reputation: 57

Tensorflow installation issue: ImportError: DLL load failed with error code -1073741795

I am unable to install and import Tensorflow on my PC. I have tried the below approach as mentioned on https://www.tensorflow.org/install/pip#package-location. I have also tried installation using Conda but the same problem appears. MS Visual C++ is also installed as mentioned on https://www.tensorflow.org/install/pip#package-location

System information

OS Platform: Windows 7 Service Pack1 TensorFlow installed from (source or binary): https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.12.0-cp35-cp35m-win_amd64.whl TensorFlow version: 1.12 Python version: 3.5.4 64-bit Installed using virtualenv

Traceback (most recent call last):

File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_i mport_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript ion) File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\im p.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\im p.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "", line 1, in File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow_init_.py", line 24, in from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-im port File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python_init_.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\si te-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_i mport_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript ion) File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\im p.py", line 243, in load_module return load_dynamic(name, filename, file) File "C:\Users\Desk\AppData\Local\Programs\Python\Python35\Scripts\venv\lib\im p.py", line 343, in load_dynamic return _load(spec) ImportError: DLL load failed with error code -1073741795

Upvotes: 0

Views: 955

Answers (2)

Ankur Bansal
Ankur Bansal

Reputation: 57

Got it fixed post looking for similar answers in internet...I had to install the tensorflow version 1.5 and the tensorflow backend loaded seamlessly

Upvotes: 0

Rahila T - Intel
Rahila T - Intel

Reputation: 862

If your CPU didn't support AVX instructions, you will get ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed. (Win 10) or ImportError: DLL load failed with error code -1073741795 (Win 7) when using tensorflow official release 1.6.0 and up (pip install tensorflow) You can use pip install [filename].whl which file download from sse2 folder instead of using official AVX binary.

Please verify whether the below command is working. pip3 install --upgrade tensorflow

You can use the below link for reference of tensorflow-windows-wheel. https://github.com/fo40225/tensorflow-windows-wheel

I have built tensorflow wheel without AVX.

https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.6.0/py36/CPU/sse2

I wish this .whl may help you.

You can install the wheel file with pip. First change the current directory to install location. Then,

pip install tensorflow-1.6.0-cp36-cp36m-win_amd64.whl

If its not working please try to resolve it by downgrading protobuf from 3.6.1 to 3.6.0:

pip install protobuf==3.6.0

Upvotes: 2

Related Questions