Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcloud-aio-* (and probably also gcloud-rest-*) trigger gcloud hook, which fails because gcloud is not installed. #730

Closed
burnpanck opened this issue Apr 19, 2024 · 1 comment · Fixed by #731
Labels
bug Something isn't working

Comments

@burnpanck
Copy link

Describe the bug

When attempting to build a project which depends on one of the above mentioned packages, the gcloud hook is triggered because those packages install into gcloud.aio namespace package. However, the hook fails at copy_metadata("gcloud") with the error importlib.metadata.PackageNotFoundError: No package metadata was found for gcloud.

Full traceback

Traceback (most recent call last):
  File "/Users/yves/epymetrics/graphical-interfaces/emda2-streamlit/.venv/lib/python3.12/site-packages/PyInstaller/depend/imphook.py", line 383, in _load_hook_module
    self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/yves/epymetrics/graphical-interfaces/emda2-streamlit/.venv/lib/python3.12/site-packages/PyInstaller/compat.py", line 591, in importlib_load_source
    mod_loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/yves/epymetrics/graphical-interfaces/emda2-streamlit/.venv/lib/python3.12/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gcloud.py", line 15, in <module>
    datas = copy_metadata('gcloud')
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/yves/epymetrics/graphical-interfaces/emda2-streamlit/.venv/lib/python3.12/site-packages/PyInstaller/utils/hooks/__init__.py", line 957, in copy_metadata
    dist = importlib_metadata.distribution(package_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/yves/.pyenv/versions/3.12.2/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 861, in distribution
    return Distribution.from_name(distribution_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/yves/.pyenv/versions/3.12.2/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/metadata/__init__.py", line 399, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for gcloud

Desktop (please complete the following information):

  • OS: [e.g. Windows/Ubuntu]: macOS
  • Python Version: 3.12
  • Version of pyinstaller-hooks-contrib: 2024.4
  • Version of PyInstaller: 6.6
@burnpanck burnpanck added the state:triage We're still figuring out how severe this issue is label Apr 19, 2024
@rokm rokm added bug Something isn't working and removed state:triage We're still figuring out how severe this issue is labels Apr 19, 2024
@rokm
Copy link
Member

rokm commented Apr 19, 2024

Indeed. The hook was written for this gcloud, hence the conflict. While both gcloud and pyrebase (from pyinstaller/pyinstaller#5316, which was original motivation for #68) seem to not be actively developed anymore, they are at least still installable and importable, so I think the best solution here is to wrap that copy_metadata call in try/except block and suppress the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants