Tensorflow – Ningún módulo llamado ‘_pywrap_tensorflow_internal’

Actualmente estoy intentando que tensorflow – Windows 64bit (solo la versión de la CPU) se ejecute en mi PC. Cuando python object_detection/builders/model_builder_test.py el comando python object_detection/builders/model_builder_test.py obtengo el error a continuación. Busqué en línea, y el 99% de las respuestas son para usar cd, lo cual creo que lo intenté pero no funcionó. Digo ‘creo’ debido a que no sé si realmente intenté usar cd correctamente, ya que no estaba al 100% de cómo iba a usar cd en mi escenario.

 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 "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", 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  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  _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  import tensorflow as tf File "C:\Users\Benan\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in  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  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  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 "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 658, in _load_unlocked File "", line 571, in module_from_spec File "", line 922, in create_module File "", 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  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  _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. 

¡¡Gracias por adelantado!!

Pude arreglarlo yo mismo, aquí está cómo:

En la página de github https://github.com/tensorflow/tensorflow/issues/17386 , descubrí que la causa de este problema puede deberse a que la CPU carece de instrucciones AVX. Las Extensiones de vectores avanzadas (AVX) son un conjunto de instrucciones para realizar operaciones de datos múltiples de instrucción única (SIMD).

Estaba ejecutando un Intel Core Duo, que no aparece en la lista de todas las CPUs AMD e Intel compatibles con AVX, que se pueden encontrar aquí: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX

En esa página de github, un usuario con el nombre de fo40225, había comstackdo un .whl para tensorflow, que se había construido sin AVX. Se puede encontrar aquí: https://github.com/fo40225/tensorflow-windows-wheel/tree/master/1.9.0/py36/CPU/sse2

Primero tuve que desinstalar tensorflow con pip uninstall tensorflow , luego lo reinstalé usando el .whl que se ha creado sin AVX usando pip install /example/path/to/.whl

Después de instalar el problema se solucionó!