Reputation: 8041
I have a python script that starts as follows:
from google.cloud import bigquery
This package is installed with:
pip install google-cloud-bigquery --upgrade
Im under the impression that pyinstaller should find all of the required packages and install them but when I run the created .exe on windows or executable on mac, I get the error message:
pkg_resources.DistributionNotFound: The 'google-cloud-core' distribution was not found and is required by the application
Here is my .spec file, please tell me where I can put google-cloud-core
so that the correct packages are installed.
# -*- mode: python -*-
block_cipher = None
a = Analysis(['tests.py'],
pathex=['/Users/daniellee/Development/alice-connectors/aconn'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='tests',
debug=False,
strip=False,
upx=True,
console=True )
Thanks in advance.
Upvotes: 3
Views: 1165
Reputation: 8041
So this is how I got it to work.
Use a hook file, named hook-google.cloud.bigquery
that contains:
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('google-cloud-bigquery')
datas += copy_metadata('google-cloud-core')
Then add the path to this hook file to your .spec file.
...
hookspath=['/Users/joesoap/Development/project/hooks']
...
Hope this helps someone.
Upvotes: 3