Skip to content

AttributeError: module 'grpc.experimental.aio' has no attribute 'Call' #173

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

Closed
JUNIORCO opened this issue Aug 4, 2020 · 4 comments
Closed
Assignees
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. external This issue is blocked on a bug with the actual product. needs more info This issue needs more information from the customer to proceed. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@JUNIORCO
Copy link

JUNIORCO commented Aug 4, 2020

I'm just trying to set up an HTTP-triggered Cloud Function that will act as a Webhook and upon receiving a POST request will publish a message. It seems simple enough, so I coded it up and deployed it. However, it kept crashing. So I tried running it locally using functions-framework, and found the culprit to be from google.cloud import pubsub_v1 which is causing the error AttributeError: module 'grpc.experimental.aio' has no attribute 'Call'

Environment details

Running on a Cloud Function with Python 3.7

Code example

main.py
from flask import Flask, request, abort, Response
import hmac
import hashlib
import base64
import os
import requests

from google.cloud import pubsub_v1

app = Flask(__name__)

@app.route('/', methods=['POST'])
def connectToSheets(request):
    # Do stuff

if __name__ == '__main__':
    app.run()
requirements.txt
flask==1.1.2
requests==2.24.0
google-cloud-pubsub==1.7.0

Stack trace

Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\user\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\functions-framework.exe\__main__.py", line 7, in <module>
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\functions_framework\_cli.py", line 37, in _cli
    app = create_app(target, source, signature_type)
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\functions_framework\__init__.py", line 229, in create_app
    spec.loader.exec_module(source_module)
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\user\Desktop\Cookiestruct - Summer 2020 Internship\Automation\Artist\cloudpy\connectToShopify\main.py", line 8, in <module>
    from google.cloud import pubsub_v1
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\cloud\pubsub_v1\__init__.py", line 18, in <module>
    from google.cloud.pubsub_v1 import publisher
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\cloud\pubsub_v1\publisher\__init__.py", line 17, in <module>
    from google.cloud.pubsub_v1.publisher.client import Client
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\cloud\pubsub_v1\publisher\client.py", line 32, in <module>
    from google.cloud.pubsub_v1.gapic import publisher_client
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\cloud\pubsub_v1\gapic\publisher_client.py", line 28, in <module>
    import google.api_core.gapic_v1.client_info
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\api_core\gapic_v1\__init__.py", line 26, in <module>
    from google.api_core.gapic_v1 import method_async  # noqa: F401
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\api_core\gapic_v1\method_async.py", line 20, in <module>
    from google.api_core import general_helpers, grpc_helpers_async
  File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\google\api_core\grpc_helpers_async.py", line 38, in <module>
    class _WrappedCall(aio.Call):
AttributeError: module 'grpc.experimental.aio' has no attribute 'Call'

Thank you!

@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/python-pubsub API. label Aug 4, 2020
@plamut plamut added the type: question Request for information or clarification. Not an issue. label Aug 4, 2020
@pradn
Copy link
Contributor

pradn commented Aug 12, 2020

This seems like an issue with grpc-core.

googleapis/python-api-core#40

Please try bumping the version of grpcio to >= 1.29.0.

https://github.com/googleapis/python-api-core/pull/41/files

@pradn
Copy link
Contributor

pradn commented Aug 12, 2020

Alternatively you can pin google-api-core to 1.16.0.

@Davidholte
Copy link

Davidholte commented Aug 25, 2020

I had the same error using google-cloud-pubsub 1.7.0 with google-api-core 1.22.1, i managed to resolve it by bumping the version of grpcio to 1.31.0

@plamut
Copy link
Contributor

plamut commented Aug 31, 2020

@JUNIORCO Did bumping the versions google-api-core and grpcio dependencies help with the reported issue for you, too?

Kasekopf added a commit to Kasekopf/Turbine that referenced this issue Dec 2, 2020
@meredithslota meredithslota added external This issue is blocked on a bug with the actual product. needs more info This issue needs more information from the customer to proceed. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: question Request for information or clarification. Not an issue. labels Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/python-pubsub API. external This issue is blocked on a bug with the actual product. needs more info This issue needs more information from the customer to proceed. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants