Zappa deployment "cannot import name 'discovery_cache' from 'googleapiclient'

39 Views Asked by At

I have a zappa/django AWS deployment that is mostly working, but it fails with this stack trace:

  File "/var/task/help_desk/models.py", line 409, in send_emails
    service = gmail.get_service(sender_id="coach" if self.thread.cat==Thread.CAT_COACH else None)
  File "/var/task/help_desk/gmail.py", line 22, in get_service
    service = build('gmail', 'v1', credentials=delegated_credentials)
  File "/var/task/googleapiclient/_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/var/task/googleapiclient/discovery.py", line 287, in build
    content = _retrieve_discovery_doc(
  File "/var/task/googleapiclient/discovery.py", line 387, in _retrieve_discovery_doc
    from . import discovery_cache
ImportError: cannot import name 'discovery_cache' from 'googleapiclient' (/var/task/googleapiclient/__init__.py)

This does not fail when running it on a local copy. I have hunted around, and this module is installed in the google-api-python-client package. This package is listed in my requirements.txt and is present in my local virtual env. I am not sure why it is not present in the zappa deployment or how to get it there.

If I list the lib/googleapiclient/discovery_cache, it is present on my local project and it is also present if I run the 'pip show -f google-api-python-client' command locally.

0

There are 0 best solutions below