I have used Pyinstaller (3.4) other times with python 3.6 on windows 10, but this time I am having trouble with the module _pywrap_tensorflow_internal (tensorflow-gpu 1.12). The program runs perfectly on the computer where it is generated, but on other computers (with the same OS version) there is a path problem.
I have found some threads (Tensorflow-gpu with pyinstaller, Windows 10 pyinstaller tensorflow missing modules, https://github.com/pyinstaller/pyinstaller/issues/3754) discussing a similar problem, but the solutions suggested are not working in my case.
At first I was getting the following error:
Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper File "imp.py", line 297, in find_module ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "hands_up_bending_counter_object_oriented.py", line 12, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "tf_pose__init__.py", line 5, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "tf_pose\runner.py", line 7, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "tf_pose\common.py", line 3, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow__init__.py", line 24, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python__init__.py", line 49, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in ImportError: Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper File "imp.py", line 297, in find_module ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper ImportError: DLL load failed: The specified module could not be found.
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. [32124] Failed to execute script hands_up_bending_counter_object_oriented
I have tried to place the file _pywrap_tensorflow_internal.pyd into a subdirectory /tensorflow/python
in the dist folder (by modifying the .spec
file), as suggested by (https://github.com/pyinstaller/pyinstaller/issues/3754), but now the error is:
Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "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 "imp.py", line 243, in load_module File "imp.py", line 343, in load_dynamic ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "postural_analysis_fast.py", line 11, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow__init__.py", line 24, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python__init__.py", line 49, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in ImportError: Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in File "c:\dev\anaconda\envs\terminal\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper File "imp.py", line 243, in load_module File "imp.py", line 343, in load_dynamic ImportError: DLL load failed: The specified module could not be found.
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. [47340] Failed to execute script postural_analysis_fast
Edit (24.04.2019):
I have tried to use Dependencies tool to analyze _pywrap_tensorflow_internal.pyd, and here is the result: Dependencies result.
I cannot find in the documentation of Dependencies what does the red question mark mean (maybe missing dll?), but all those dlls are already present in my dist folder (inside the main folder).