Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

cannot import name 'GkeHubClient' #63

Closed
parthea opened this issue Aug 16, 2021 · 4 comments · Fixed by #64
Closed

cannot import name 'GkeHubClient' #63

parthea opened this issue Aug 16, 2021 · 4 comments · Fixed by #64
Assignees
Labels
api: gkehub Issues related to the googleapis/python-gke-hub API. priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@parthea
Copy link
Contributor

parthea commented Aug 16, 2021

The last release version 0.2.0 has an issue where the library cannot be imported.

Steps to reproduce

  1. pyenv virtualenv testgke
  2. pyenv activate testgke
  3. pip install google-cloud-gke-hub
  4. python3
  5. Run the code below

Code example

import google.cloud.gkehub_v1

Stack trace

>>> import google.cloud.gkehub_v1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub_v1/__init__.py", line 17, in <module>
    from .services.gke_hub import GkeHubClient
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub_v1/services/gke_hub/__init__.py", line 16, in <module>
    from .client import GkeHubClient
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub_v1/services/gke_hub/client.py", line 35, in <module>
    from google.cloud.gkehub_v1.services.gke_hub import pagers
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub_v1/services/gke_hub/pagers.py", line 27, in <module>
    from google.cloud.gkehub_v1.types import feature
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub_v1/types/__init__.py", line 16, in <module>
    from .feature import (
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub_v1/types/feature.py", line 18, in <module>
    from google.cloud.gkehub import configmanagement_v1 as configmanagement_pb2  # type: ignore
  File "/usr/local/google/home/partheniou/.pyenv/versions/testgke/lib/python3.6/site-packages/google/cloud/gkehub/__init__.py", line 17, in <module>
    from google.cloud.gkehub_v1.services.gke_hub.client import GkeHubClient
ImportError: cannot import name 'GkeHubClient'
@parthea parthea added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p0 Highest priority. Critical issue. P0 implies highest priority. labels Aug 16, 2021
@parthea parthea self-assigned this Aug 16, 2021
@product-auto-label product-auto-label bot added the api: gkehub Issues related to the googleapis/python-gke-hub API. label Aug 16, 2021
@parthea
Copy link
Contributor Author

parthea commented Aug 16, 2021

I was able to resolve the issue using the code in #64 by moving the dependencies configmanagement_v1 and multiclusteringress_v1 from the original location /google/cloud/gkehub to /google/cloud/gkehub_v1.

We could also solve this by publishing proto only packages for google-cloud-gke-hub-config-management and google-cloud-gke-hub-multi-clusteringress.

@busunkim96 WDYT?

@tseaver
Copy link

tseaver commented Aug 16, 2021

@parthea I prefer your solution as outlined in PR #64. IIRC, we talked about proto-only packages some years back, and decided that "multiplying the entities" was too much trouble: having them in the same repo means that new features / breaking changes in the protobuf files are easier to track in the client libraries.

@busunkim96
Copy link
Contributor

@parthea 👋 Do you need help with this one? Is the P0 label still appropriate?

@parthea
Copy link
Contributor Author

parthea commented Aug 20, 2021

@busunkim96 I've just updated the PR with the changes as discussed. Please can you take another look? I think P0 is appropriate as the v1 client is currently broken.

gcf-merge-on-green bot pushed a commit that referenced this issue Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: gkehub Issues related to the googleapis/python-gke-hub API. priority: p0 Highest priority. Critical issue. P0 implies highest priority. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants