title: Pyinstaller not including google-api-python-client
body: <p>I have written a Kivy application and I am now trying to use PyInstaller to package it for MacOS. It uses the Google Calendar API so I need to use the google-api-python-client module. When I packaged the application according to the Kivy packaging instructions, the google-api-python-client was not found. I got this error:</p>
  <pre><code>[INFO   ] [Logger      ] Record log in /_____/.kivy/logs/kivy_20-06-23_6.txt
  [INFO   ] [Kivy        ] v1.11.1
  [INFO   ] [Kivy        ] Installed at &quot;/____.app/Contents/MacOS/kivy/__init__.pyc&quot;
  [INFO   ] [Python      ] v3.7.4 (v3.7.4:e09359112e, Jul  8 2019, 14:54:52) 
  [Clang 6.0 (clang-600.0.57)]
  [INFO   ] [Python      ] Interpreter at &quot;/____/Contents/MacOS/___&quot;
  [INFO   ] [Factory     ] 184 symbols loaded
  [INFO   ] [Image       ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
  [INFO   ] [Text        ] Provider: sdl2
  [INFO   ] [Window      ] Provider: sdl2
  [INFO   ] [GL          ] Using the &quot;OpenGL ES 2&quot; graphics system
  [INFO   ] [GL          ] Backend used &lt;sdl2&gt;
  [INFO   ] [GL          ] OpenGL version &lt;b'2.1 INTEL-14.5.22'&gt;
  [INFO   ] [GL          ] OpenGL vendor &lt;b'Intel Inc.'&gt;
  [INFO   ] [GL          ] OpenGL renderer &lt;b'Intel Iris Pro OpenGL Engine'&gt;
  [INFO   ] [GL          ] OpenGL parsed version: 2, 1
  [INFO   ] [GL          ] Shading version &lt;b'1.20'&gt;
  [INFO   ] [GL          ] Texture max size &lt;16384&gt;
  [INFO   ] [GL          ] Texture max units &lt;16&gt;
  [INFO   ] [Window      ] auto add sdl2 input provider
  [INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
   Traceback (most recent call last):
     File &quot;main.py&quot;, line 11, in &lt;module&gt;
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 983, in _find_and_load
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 967, in _find_and_load_unlocked
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 677, in _load_unlocked
     File &quot;/the_venv_directory/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py&quot;, line 623, in exec_module
       exec(bytecode, module.__dict__)
     File &quot;googleapiclient/discovery.py&quot;, line 67, in &lt;module&gt;
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 983, in _find_and_load
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 967, in _find_and_load_unlocked
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 677, in _load_unlocked
     File &quot;/the_venv_directory/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py&quot;, line 623, in exec_module
       exec(bytecode, module.__dict__)
     File &quot;googleapiclient/http.py&quot;, line 67, in &lt;module&gt;
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 983, in _find_and_load
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 967, in _find_and_load_unlocked
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 677, in _load_unlocked
     File &quot;/the_venv_directory/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py&quot;, line 623, in exec_module
       exec(bytecode, module.__dict__)
     File &quot;googleapiclient/model.py&quot;, line 36, in &lt;module&gt;
     File &quot;pkg_resources/__init__.py&quot;, line 481, in get_distribution
     File &quot;pkg_resources/__init__.py&quot;, line 357, in get_provider
     File &quot;pkg_resources/__init__.py&quot;, line 900, in require
     File &quot;pkg_resources/__init__.py&quot;, line 786, in resolve
   pkg_resources.DistributionNotFound: The 'google-api-python-client' distribution was not found and is required by the application
  [64310] Failed to execute script main
  logout
  </code></pre>
  <p>This is my spec file:</p>
  <pre><code># -*- mode: python ; coding: utf-8 -*-
  
  block_cipher = None
  
  
  a = Analysis(['main.py'],
               pathex=['Project Parent Directory'],
               binaries=[],
               datas=[],
               hiddenimports=[],
               hookspath=[],
               runtime_hooks=[],
               excludes=['_tkinter', 'Tkinter', 'enchant', 'twisted'],
               win_no_prefer_redirects=False,
               win_private_assemblies=False,
               cipher=block_cipher,
               noarchive=False)
  pyz = PYZ(a.pure, a.zipped_data,
               cipher=block_cipher)
  exe = EXE(pyz,
            a.scripts,
            [],
            exclude_binaries=True,
            name='___',
            debug=False,
            bootloader_ignore_signals=False,
            strip=False,
            upx=True,
            console=False , icon='Icon.icns')
  coll = COLLECT(exe,
                 a.binaries,
                 a.zipfiles,
                 a.datas,
                 strip=False,
                 upx=True,
                 upx_exclude=[],
                 name='___')
  app = BUNDLE(coll,
               name='___.app',
               icon='Icon.icns',
               bundle_identifier=&quot;com.___.talkingcalendar&quot;)
  </code></pre>
  <p>I have looked at <a href="https://stackoverflow.com/questions/61510900/the-google-api-python-client-distribution-was-not-found-and-is-required-by-the">this</a> post, but the answer did not work with PyInstaller. Thanks for any help!</p>