Trying to distribute a program that relies on tensorflow...
Using tensorflow it works nicely both as script and with pyinstaller. Using tensorflow-gpu it works as script but not with pyinstaller. The cuda and cudnn dlls have been copied into the bundle folder by pyinstaller.
I use python 3.6.5 and tensorflow 1.7.0. (Can change version if it helps...)
Error message:
Traceback (most recent call last): File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.dict) File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper File "importlib__init__.py", line 126, in import_module ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "interface.py", line 14, in File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.dict) File "site-packages\tensorflow__init__.py", line 24, in File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.dict) File "site-packages\tensorflow\python__init__.py", line 49, in File "c:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.dict) 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:\users\aleks\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module exec(bytecode, module.dict) File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17, in swig_import_helper File "importlib__init__.py", line 126, in import_module ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. [10816] Failed to execute script interface
tensorflow
subdirectory with an__init__.py
in it, which Python will prefer to any other installations. (Or something similar; atensorflow.py
might work too.) – Allen Lavoie