1 year ago
#145462

Shane Bishop
Building an executable with PyInstaller on Windows
I want to create a Windows executable using PyInstaller.
My project has the following dependencies:
- deepspeech
- PyAudio (which in turn depends on the PortAudio C library)
- tkinter
I tried building the executable by running the command below:
pyinstaller entrypoint.py --name speech-to-text-gui --onedir --hidden-import numpy.random.common --hidden-import numpy.random.bounded_integers --hidden-import numpy.random.entropy
I initially tried building without any --hidden-import
arguments, but then I would get errors like
ModuleNotFoundError: No module named 'numpy.random.common'
After the build, when I run the executable, it crashes with the following traceback:
Traceback (most recent call last): File "entrypoint.py", line 1, in from speech_to_text_gui.__main__ import main File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "speech_to_text_gui\__main__.py", line 5, in from speech_to_text_gui import speech_to_text_gui File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "speech_to_text_gui\speech_to_text_gui.py", line 16, in from deepspeech import Model File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "deepspeech\__init__.py", line 23, in File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module File "deepspeech\impl.py", line 13, in ImportError: DLL load failed: The specified module could not be found. [12236] Failed to execute script 'entrypoint' due to unhandled exception!
The program runs fine when I run it directly with python entrypoint.py
.
I looked through the PyInstaller "If Things Go Wrong" page but nothing jumped out at me as wrong with how I am building.
I also tried building on Linux, and the executable built and ran just fine without any runtime errors on Linux.
From the traceback, my guess is loading a DLL for deepspeech failed, since that is the last call in the traceback. But take that with a grain of salt.
I am looking for any suggestions anyone might have to troubleshoot this build.
python
windows
pyinstaller
mozilla-deepspeech
0 Answers
Your Answer