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

Error when importing PublisherClient #132

Closed
gariyanto opened this issue Apr 30, 2021 · 6 comments · Fixed by #133
Closed

Error when importing PublisherClient #132

gariyanto opened this issue Apr 30, 2021 · 6 comments · Fixed by #133
Assignees
Labels
api: pubsublite Issues related to the googleapis/python-pubsublite API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@gariyanto
Copy link

gariyanto commented Apr 30, 2021

Hi I followed the doc and got error when importing the PublisherClient.
from google.cloud.pubsublite.cloudpubsub import PublisherClient

Environment details

  • OS type and version: MacOS BigSurr 11.2.3
  • Python version: Python 3.6.7
  • pip version: pip 21.1
  • google-cloud-pubsublite version: Name: google-cloud-pubsublite Version: 0.4.0
  • 'pip freeze':
cachetools==4.2.2
certifi==2020.12.5
chardet==4.0.0
google-api-core==1.26.3
google-auth==1.30.0
google-cloud-pubsub==2.4.1
google-cloud-pubsublite==0.4.0
googleapis-common-protos==1.53.0
grpc-google-iam-v1==0.12.3
grpcio==1.37.1
idna==2.10
libcst==0.3.18
mypy-extensions==0.4.3
overrides==5.0.1
packaging==20.9
proto-plus==1.18.1
protobuf==3.15.8
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==2.4.7
pytz==2021.1
PyYAML==5.4.1
requests==2.25.1
rsa==4.7.2
six==1.15.0
typing-extensions==3.7.4.3
typing-inspect==0.6.0
typing-utils==0.0.3
urllib3==1.26.4

Steps to reproduce

I followed the doc in the https://googleapis.dev/python/pubsublite/latest/publisher/index.html

  1. Install venv
  2. pip install google-cloud-pubsublite

Code example

from google.cloud.pubsublite.cloudpubsub import PublisherClient

Stack trace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/google/cloud/pubsublite/cloudpubsub/__init__.py", line 18, in <module>
    from .publisher_client import AsyncPublisherClient, PublisherClient
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/google/cloud/pubsublite/cloudpubsub/publisher_client.py", line 29, in <module>
    from google.cloud.pubsublite.cloudpubsub.internal.multiplexed_publisher_client import (
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/google/cloud/pubsublite/cloudpubsub/internal/multiplexed_publisher_client.py", line 35, in <module>
    class MultiplexedPublisherClient(PublisherClientInterface):
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/google/cloud/pubsublite/cloudpubsub/internal/multiplexed_publisher_client.py", line 50, in MultiplexedPublisherClient
    ) -> "Future[str]":
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/overrides/overrides.py", line 67, in overrides
    return _overrides(method, check_signature, check_at_runtime)
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/overrides/overrides.py", line 93, in _overrides
    _validate_method(method, super_class, check_signature)
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/overrides/overrides.py", line 114, in _validate_method
    ensure_signature_is_compatible(super_method, method, is_static)
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/overrides/signature.py", line 75, in ensure_signature_is_compatible
    super_type_hints = _get_type_hints(super_callable)
  File "/Users/gunawan/.virtualenv/pb1/lib/python3.6/site-packages/overrides/signature.py", line 46, in _get_type_hints
    return get_type_hints(callable)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 1543, in get_type_hints
    value = _eval_type(value, globalns, localns)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 350, in _eval_type
    return t._eval_type(globalns, localns)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/typing.py", line 245, in _eval_type
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
TypeError: 'type' object is not subscriptable
@product-auto-label product-auto-label bot added the api: pubsublite Issues related to the googleapis/python-pubsublite API. label Apr 30, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Apr 30, 2021
@MelchiSalins
Copy link

Even I am facing the a similar issue with python 3. Tried downgrading to version 0.3.0 of the pubsublite client and see the following error

`Python 3.9.0 (default, Dec 8 2020, 00:44:44)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from google.cloud.pubsublite.cloudpubsub import PublisherClient
Traceback (most recent call last):
File "", line 1, in
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/google/cloud/pubsublite/cloudpubsub/init.py", line 23, in
from .subscriber_client import AsyncSubscriberClient, SubscriberClient
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/google/cloud/pubsublite/cloudpubsub/subscriber_client.py", line 29, in
from google.cloud.pubsublite.cloudpubsub.internal.multiplexed_subscriber_client import (
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/google/cloud/pubsublite/cloudpubsub/internal/multiplexed_subscriber_client.py", line 39, in
class MultiplexedSubscriberClient(SubscriberClientInterface):
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/google/cloud/pubsublite/cloudpubsub/internal/multiplexed_subscriber_client.py", line 61, in MultiplexedSubscriberClient
def subscribe(
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/overrides/overrides.py", line 88, in overrides
return _overrides(method, check_signature, check_at_runtime)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/overrides/overrides.py", line 114, in _overrides
_validate_method(method, super_class, check_signature)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/overrides/overrides.py", line 135, in _validate_method
ensure_signature_is_compatible(super_method, method, is_static)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/overrides/signature.py", line 83, in ensure_signature_is_compatible
ensure_all_kwargs_defined_in_sub(
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/overrides/signature.py", line 138, in ensure_all_kwargs_defined_in_sub
and not _issubtype(super_type_hints[name], sub_type_hints[name])
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/overrides/signature.py", line 41, in _issubtype
return issubtype(left, right)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/typing_utils/init.py", line 274, in issubtype
return _is_normal_subtype(normalize(left), normalize(right), forward_refs)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/typing_utils/init.py", line 177, in normalize
args = tuple(normalize(a) for a in args)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/typing_utils/init.py", line 177, in
args = tuple(normalize(a) for a in args)
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/typing_utils/init.py", line 171, in normalize
return NormalizedType(_ensure_builtin(tp))
File "/Users/melchisalins/virtualenvs/python3_mflow/lib/python3.9/site-packages/typing_utils/init.py", line 49, in _ensure_builtin
if tp in BUILTINS_MAPPING:
TypeError: unhashable type: 'list'
`

@dpcollins-google
Copy link
Collaborator

Hi all,

I'm currently looking into this issue, although I'm currently unable to reproduce locally. I'll update this issue with any progress.

-Daniel

@anguillanneuf anguillanneuf added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels May 5, 2021
@anguillanneuf anguillanneuf added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label May 5, 2021
@anguillanneuf
Copy link
Collaborator

Thanks @MelchiSalins and @gariyanto for reporting this issue! This will be fixed soon in the next release. We are cutting a release now.

@dpcollins-google
Copy link
Collaborator

The new release has been created which should resolve this issue.

@MelchiSalins
Copy link

Will test it today.

@MelchiSalins
Copy link

Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsublite Issues related to the googleapis/python-pubsublite API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
5 participants