title: ImportError: cannot import name 'modname_tkinter' from 'PyInstaller.compat'
body: <p>PyInstaller: 5.0.1
  Python: 3.7.9
  output: <a href="https://gist.github.com/phonebotco/eee157bd12a3b9f0792b2fcab9478636" rel="nofollow noreferrer">https://gist.github.com/phonebotco/eee157bd12a3b9f0792b2fcab9478636</a></p>
  <p>I am trying to compilate my code with this command:</p>
  <p><code>pyinstaller --onefile -F --uac-admin --icon=&quot;favicon_phonebot.ico&quot; --exclude-module modname_tkinter --debug=all PhoneBot.py</code></p>
  <p>I get this error message:</p>
  <pre><code>  File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-IPython.py&quot;, line 16, in &lt;module&gt;
      from PyInstaller.compat import modname_tkinter, is_win, is_darwin
  ImportError: cannot import name 'modname_tkinter' from 'PyInstaller.compat' (c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\compat.py)
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\runpy.py&quot;, line 193, in _run_module_as_main
      &quot;__main__&quot;, mod_spec)
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\runpy.py&quot;, line 85, in _run_code
      exec(code, run_globals)
    File &quot;C:\Users\gauth\AppData\Local\Programs\Python\Python37\Scripts\pyinstaller.exe\__main__.py&quot;, line 7, in &lt;module&gt;
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\__main__.py&quot;, line 178, in run
      run_build(pyi_config, spec_file, **vars(args))
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\__main__.py&quot;, line 59, in run_build
      PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 845, in main
      build(specfile, distpath, workpath, clean_build)
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 767, in build
      exec(code, spec_namespace)
    File &quot;H:\Mon Drive\Phonebot\Phonebot_debug3\PhoneBot.spec&quot;, line 20, in &lt;module&gt;
      noarchive=False,
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 319, in __init__
      self.__postinit__()
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\datastruct.py&quot;, line 173, in __postinit__
      self.assemble()
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\building\build_main.py&quot;, line 487, in assemble
      self.graph.process_post_graph_hooks(self)
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\depend\analysis.py&quot;, line 326, in process_post_graph_hooks
      module_hook.post_graph(analysis)
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\depend\imphook.py&quot;, line 398, in post_graph
      self._load_hook_module()
    File &quot;c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\depend\imphook.py&quot;, line 364, in _load_hook_module
      raise ImportErrorWhenRunningHook(self.hook_module_name, self.hook_filename)
  PyInstaller.exceptions.ImportErrorWhenRunningHook: Failed to import module __PyInstaller_hooks_0_IPython required by hook for module c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-IPython.py. Please check whether module __PyInstaller_hooks_0_IPython actually exists and whether the hook is compatible with your version of c:\users\gauth\appdata\local\programs\python\python37\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-IPython.py: You might want to read more about hooks in the manual and provide a pull-request to improve PyInstaller.
  
  H:\Mon Drive\Phonebot\Phonebot_debug3&gt;pyinstaller --onefile -F --uac-admin --icon=&quot;favicon_phonebot.ico&quot; --exclude-module modname_tkinter --debug=all PhoneBot.py
  </code></pre>
  <p>The weird thing is I don't use Tkinter in my code. Can anyone help me please fix this issue?</p>
  <p>Thanks</p>