Reputation: 1322
I have this import statement in python:
from google.cloud.exceptions import NotFound
I get this exception:
ModuleNotFoundError: No module named 'google.cloud.exceptions'
My pip freeze has the following lines:
google-api-core==1.14.3
google-auth==1.7.1
google-cloud==0.34.0
google-cloud-tasks==1.3.0
googleapis-common-protos==1.6.0
grpc-google-iam-v1==0.12.3
What should I do / pip install to make this work?
Upvotes: 5
Views: 7378
Reputation: 42
You need to add google-cloud
to your requirements.txt
file.
The module was renamed from google.cloud
to google.api_core
so your import will look like the following:
from google.api_core.exceptions import NotFound
Upvotes: 2
Reputation: 313
According to docs: https://google-cloud-python.readthedocs.io/en/0.32.0/core/exceptions.html, you can just do pip install google-cloud
and then in python file, from google.api_core.exceptions import <YOUR_EXCEPTION>
you're missing .api_core
in your import
Upvotes: 1