Vuki
Vuki

Reputation: 21

Python pyinstaller error when converting to exe

These are the erros when i converted to exe and run it:

Traceback (most recent call last):
  File "NoneServerV1.py", line 24, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\glasmor\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pyrebase\__init__.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\glasmor\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "pyrebase\pyrebase.py", line 18, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\users\glasmor\appdata\local\programs\python\python38-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "gcloud\__init__.py", line 19, in <module>
  File "pkg_resources\__init__.py", line 480, in get_distribution
  File "pkg_resources\__init__.py", line 356, in get_provider
  File "pkg_resources\__init__.py", line 899, in require
  File "pkg_resources\__init__.py", line 785, in resolve
pkg_resources.DistributionNotFound: The 'gcloud' distribution was not found and is required by the application
[3108] Failed to execute script NoneServerV1

Maybe someone can help me(I think the problem is with pyrebase bcs i coded a login and auth system with it)

Upvotes: 1

Views: 1294

Answers (2)

Vuki
Vuki

Reputation: 21

i fixed it by creating in lib/site-packages/pyinstaller/hooks a file called hook-gcloud.py and i edited it with: from PyInstaller.utils.hooks import copy_metadata

datas = copy_metadata('gcloud')

Upvotes: 1

Canute S
Canute S

Reputation: 394

If you are using the --onefile switch try to make a build without the switch. This will generate a folder where you can find a smaller exe. Run it and check if you have the same error. In the folder check if the gcloud package exists. It looks like it is not able to find the gcloud package.

If it doesn't exist then use the switch --hidden-import gcloud.

Upvotes: 0

Related Questions