1

Currently I am trying to get tensorflow - Windows 64bit (just the cpu version) running on my pc. When running the command python object_detection/builders/model_builder_test.pyI get the error below. I searched online, and 99% of the answers are to use cd, which I think I've tried but that didn't work. I say 'I think' due to me not knowing whether I actually correctly tried using cd - as I was not 100% on how I was going to use cd in my scenario.

C:\Users\Benan\Documents\BaseballProject>python tensorflow/models/research/object_detection/builders/model_builder_test.py
    Traceback (most recent call last):
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
        return importlib.import_module(mname)
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 571, in module_from_spec
      File "<frozen importlib._bootstrap_external>", line 922, in create_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
        from tensorflow.python.pywrap_tensorflow_internal import *
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
        _pywrap_tensorflow_internal = swig_import_helper()
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
        return importlib.import_module('_pywrap_tensorflow_internal')
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
    ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "tensorflow/models/research/object_detection/builders/model_builder_test.py", line 18, in <module>
        import tensorflow as tf
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
        from tensorflow.python import *  # pylint: disable=redefined-builtin
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
        from tensorflow.python import pywrap_tensorflow
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
        raise ImportError(msg)
    ImportError: Traceback (most recent call last):
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14, in swig_import_helper
        return importlib.import_module(mname)
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 571, in module_from_spec
      File "<frozen importlib._bootstrap_external>", line 922, in create_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
    ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
        from tensorflow.python.pywrap_tensorflow_internal import *
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in <module>
        _pywrap_tensorflow_internal = swig_import_helper()
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16, in swig_import_helper
        return importlib.import_module('_pywrap_tensorflow_internal')
      File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
    ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'


    Failed to load the native TensorFlow runtime.

Thanks in advance!!

Ben10
  • 500
  • 1
  • 3
  • 14
  • Are any answers from [this question](https://stackoverflow.com/questions/42011070/on-windows-running-import-tensorflow-generates-no-module-named-pywrap-tenso) helpful? – Y. Luo Apr 19 '18 at 05:38
  • @Y.Luo I have already tried install VC redist 2015 to get MSCVP140.dll, as well as manually adding it to the path. The other solutions are for gpu tensorflow - which I cannot use as I have an AMD card. – Ben10 Apr 19 '18 at 06:18
  • Sorry, I don't know then. Upvoted. – Y. Luo Apr 19 '18 at 06:42

1 Answers1

0

I was able to fix it myself, here's how:

On the github page https://github.com/tensorflow/tensorflow/issues/17386 , I found out that a cause of this problem can be caused due to the CPU lacking AVX instructions. Advanced Vector Extensions (AVX) are a set of instructions for doing Single Instruction Multiple Data (SIMD) operations.

I was running an Intel Core Duo, which does not appear on the list of all AVX compatible AMD and intel CPU's , which can be found here: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX

On that github page, a user by the name of fo40225, had compiled a .whl for tensorflow, that had been built without AVX. It can be found here: https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.9.0/py36/CPU/sse2

First I had to uninstall tensorflow with pip uninstall tensorflow, then I reinstalled it using the .whl that has been built without AVX using pip install /example/path/to/.whl

After installing the problem was fixed!

Ben10
  • 500
  • 1
  • 3
  • 14