title: Building an executable with PyInstaller on Windows
body: <p>I want to create a Windows executable using <a href="https://pyinstaller.readthedocs.io/en/stable/" rel="nofollow noreferrer">PyInstaller</a>.</p>
  <p>My project has the following dependencies:</p>
  <ul>
  <li><a href="https://deepspeech.readthedocs.io/en/latest/index.html" rel="nofollow noreferrer">deepspeech</a></li>
  <li><a href="https://people.csail.mit.edu/hubert/pyaudio/" rel="nofollow noreferrer">PyAudio</a> (which in turn depends on the <a href="http://portaudio.com/" rel="nofollow noreferrer">PortAudio</a> C library)</li>
  <li><a href="https://docs.python.org/3/library/tkinter.html" rel="nofollow noreferrer">tkinter</a></li>
  </ul>
  <p>I tried building the executable by running the command below:</p>
  <pre>
  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
  </pre>
  <p>I initially tried building without any <code>--hidden-import</code> arguments, but then I would get errors like</p>
  <pre>
  ModuleNotFoundError: No module named 'numpy.random.common'
  </pre>
  <p>After the build, when I run the executable, it crashes with the following traceback:</p>
  <pre>
  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!
  </pre>
  <p>The program runs fine when I run it directly with <code>python entrypoint.py</code>.</p>
  <p>I looked through the <a href="https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong" rel="nofollow noreferrer">PyInstaller &quot;If Things Go Wrong&quot; page</a> but nothing jumped out at me as wrong with how I am building.</p>
  <p>I also tried building on Linux, and the executable built and ran just fine without any runtime errors on Linux.</p>
  <p>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.</p>
  <p>I am looking for any suggestions anyone might have to troubleshoot this build.</p>