title: PyInstaller ModuleNotFound
body: <p>I've been grappling with PyInstaller and not sure how to fix ModuleNotFound (specifically <code>pandas</code>). My .py program is a simple onefile script that imports only (Anaconda-)native packages (eg tkinter, pandas, os) and it worked in the IDE. I know that PyInstaller only import top-level packages so I'll list my approaches so far:</p>
  
  <ol>
  <li>Run in virtual env to downgrade Python 3.8 to 3.7.5. I heard people had problem with PyInstaller with Python 3.8. Also updated latest version of PyInstaller. Also tried without env. </li>
  <li>Build from onedir instead of onefile <code>pyinstaller --onedir myscript.py</code></li>
  <li>Change <code>hiddenimports</code> in spec file to <code>hiddenimports = ['pandas._libs.tslibs.timedeltas', etc.]</code> and also <code>hiddenimports = ['pandas']</code></li>
  <li>Put <code>import pandas</code> at the top in .py </li>
  <li>Follow this one: <a href="https://stackoverflow.com/questions/59743234/how-can-i-add-a-python-site-package-folder-thats-not-being-included-to-a-pyin">How can I add a Python site-package folder (that&#39;s not being included) to a PyInstaller spec file?</a> but fix my path file to <code>C:\\Users\\username\\Anaconda\\lib</code> since this was in Anaconda interpreter. Then it raised <code>AttributeError: module 'importlib._bootstrap_external' has no attribute '_w_long'</code> and I tried to fixed it to no avail</li>
  </ol>
  
  <p>None of that has worked out. Is there a better way to go about building executable in Python or is there a fix for this? </p>