Hi I have a problem with converting my python file to exe. I have a error:
File "s.py", line 6, in <module><br>
ModuleNotFoundError: No module named 'googleapiclient'<br>
[17760] Failed to execute script s
Line 6 is:
from googleapiclient.discovery import build
When i install googleapiclient in the desame folder where the python file is i get this thing:
Traceback (most recent call last):
File "c:\program files (x86)\python38-32\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
exec(code, spec_namespace)
File "C:\Users\kompu\AppData\Local\Temp\tmp3b0mqik9\s.spec", line 6, in <module>
a = Analysis(['C:/Users/kompu/Desktop/w/s.py'],
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
self.__postinit__()
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\building\build_main.py", line 420, in assemble
self.graph.process_post_graph_hooks()
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\depend\analysis.py", line 367, in process_post_graph_hooks
module_hook.post_graph()
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\depend\imphook.py", line 447, in post_graph
self._load_hook_module()
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\depend\imphook.py", line 408, in _load_hook_module
self._hook_module = importlib_load_source(
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\compat.py", line 598, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 962, in load_module
File "<frozen importlib._bootstrap_external>", line 787, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\program files (x86)\python38-32\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-google.api_core.py", line 14, in <module>
datas = copy_metadata('google-api-core')
File "c:\program files (x86)\python38-32\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 977, in copy_metadata
dist = pkg_resources.get_distribution(package_name)
File "c:\program files (x86)\python38-32\lib\site-packages\pkg_resources\__init__.py", line 482, in get_distribution
dist = get_provider(dist)
File "c:\program files (x86)\python38-32\lib\site-packages\pkg_resources\__init__.py", line 358, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "c:\program files (x86)\python38-32\lib\site-packages\pkg_resources\__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "c:\program files (x86)\python38-32\lib\site-packages\pkg_resources\__init__.py", line 787, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'google-api-core' distribution was not found and is required by the application
I was installing and uninstalling, upgrading itp. googleapiclient several times. Idk what can I do more.
Please help me guys.
I have also encountered this error before. To fix this you need to go to build your exe, then go to site-packages folder inside lib folder, so for me its:
C:\Users\ - Your User - \AppData\Local\Programs\Python\Python39\Lib\site-packages
There you need to locate your module - googleapiclient - (it should be a folder) and copy it to your dist folder where the exe is stored.