tensorflow issue: ImportError: DLL load failed: %1 is not a valid Win32 application. ModuleNotFoundError: No module named '_pywrap_tensorflow_internal' #2323
Top level directory for model: D:\Study\ML\RNN\models\tutorials\rnn\ptb
Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Made no change to the code i cloned frm GIT
OS Platform and Distribution: Windows 8.1
-**Python 3.6.1 [MSC v.1900 64 bit (AMD64)]
TensorFlow installed from (source or binary): Source
TensorFlow version (use command below): 1.3.0
GPU model and memory: No GPU. It's a CPU system CPU@1.90GHz
Exact command to reproduce: python ptb_word_lm.py --data_path=D:/Study/ML/RNN/simple-examples/data/ --model=small
logs
D:\Study\ML\RNN\models\tutorials\rnn\ptb>python ptb_word_lm.py --data_path=D:/Study/ML/RNN/simple-examples/data/ --model=small
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Python36\lib\importlib__init__.py", line 126, in impor
t_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 648, in _load_unlocked
File "", line 560, in module_from_spec
File "", line 922, in create_module
File "", line 205, in _call_with_frames_removed
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files\Python36\lib\importlib__init__.py", line 126, in impor
t_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 "ptb_word_lm.py", line 65, in
import tensorflow as tf
File "C:\Program Files\Python36\lib\site-packages\tensorflow__init.py", lin
e 24, in
from tensorflow.python import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python__init__.p
y", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 52, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Python36\lib\importlib\init__.py", line 126, in impor
t_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 648, in _load_unlocked
File "", line 560, in module_from_spec
File "", line 922, in create_module
File "", line 205, in _call_with_frames_removed
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files\Python36\lib\importlib__init__.py", line 126, in impor
t_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'
Issue resolved by this. Since mine is a non GPU system I just installed MSVCP140.DLL and included ".DLL" in PATHEXT variable as stated in the SO link. This solved my issue.
System information
logs
D:\Study\ML\RNN\models\tutorials\rnn\ptb>python ptb_word_lm.py --data_path=D:/Study/ML/RNN/simple-examples/data/ --model=small Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten sorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Program Files\Python36\lib\importlib__init__.py", line 126, in impor t_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 648, in _load_unlocked
File "", line 560, in module_from_spec
File "", line 922, in create_module
File "", line 205, in _call_with_frames_removed
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten sorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files\Python36\lib\importlib__init__.py", line 126, in impor
t_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 "ptb_word_lm.py", line 65, in
import tensorflow as tf
File "C:\Program Files\Python36\lib\site-packages\tensorflow__init.py", lin
e 24, in
from tensorflow.python import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python__init__.p
y", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 52, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Program Files\Python36\lib\importlib\ init__.py", line 126, in impor
t_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 978, in _gcd_import
File "", line 961, in _find_and_load
File "", line 950, in _find_and_load_unlocked
File "", line 648, in _load_unlocked
File "", line 560, in module_from_spec
File "", line 922, in create_module
File "", line 205, in _call_with_frames_removed
ImportError: DLL load failed: %1 is not a valid Win32 application.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten sorflow.py", line 41, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 21, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Program Files\Python36\lib\importlib__init__.py", line 126, in impor
t_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'