When I am trying to build an executable for my python script it gives me:
pkg_resources.DistributionNotFound: The \'google-cloud-firestore\' distribution wa
for two days, i have found the solution with three steps
in hook-google.cloud
add this code.
datas += copy_metadata('google-cloud-firestore')
root of hook-google.cloud.py
..
C:\Users\ASPIREone\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\PyInstaller\hooks
make
hook-google-cloud-firestore.py
in root of:
C:\Users\ASPIREone\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\PyInstaller\hooks
and add this code
from PyInstaller.utils.hooks import copy_metadata, get_package_dir
datas += copy_metadata('google-cloud-firestore')
datas += copy_metadata('google_cloud_firestore') #altlll
hiddenimports += ['google-cloud-firestore_v1']
#pythonhosted.org/pyinstaller/hooks.html#understanding-pyinstaller-hooks
#get_package_dir returns tuple (where pkg stored, abs path to pkg)
pkg_dir = 'C:/Users/ASPIREone/AppData/Local/Programs/Python/Python37-32/Lib/site-packages/google/cloud/firestore_v1'
datas += (pkg_dir, 'google-cloud-firestore')
don't forget to delete folder __pycache__
in your main project my main project is root of C:\Users\ASPIREone\PycharmProjects\amazon\parking-go
delete your app (example: main.exe) in root of:
C:\Users\ASPIREone\AppData\Local\Programs\Python\Python37-32\Scripts\dist
go to command line
don't use pyinstaller.exe --onefile main.py
but use
pyinstaller.exe --onefile --clean main.py
because m main proect in root folder so i write in command line:
pyinstaller.exe --onefile --clean C:\Users\ASPIREone\PycharmProjects\amazon\parking-go\main.py
you have to clean it and rebuild from first
it should work !
if you have an error when your app running when retrieve data or write to firestore like this:
Exception ignored in: 'grpc._cython.cygrpc.ssl_roots_override_callback'
E0527 07:10:01.571000000 3672 src/core/lib/security/security_connector/ssl_util
s.cc:449] assertion failed: pem_root_certs != nullptr
roots.pm
into your main project or where you run your app
dir of roots.pm
is
C:\Users\ASPIREone\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\grpc\_cython\_credentials\roots.pm
hook-grpc.py
and put this codefrom PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files('grpc')
go to commandline
pyinstaller.exe --onefile --clean yourmainfile.py
it should work !