2

I am trying to follow this tutorial on Google Cloud Platform, https://github.com/GoogleCloudPlatform/ai-platform-samples/blob/master/notebooks/samples/tables/census_income_prediction/getting_started_notebook.ipynb, however, I am running into issues when I try to import the autoML module, specifically the below two lines

# AutoML library.
from google.cloud import automl_v1beta1 as automl
import google.cloud.automl_v1beta1.proto.data_types_pb2 as data_types

The first line works, but for the 2nd one, I get the error: ModuleNotFoundError: No module named 'google.cloud.automl_v1beta1.proto'. It seems for some reason there is no module called proto and I cannot figure out how to resolve this. There are a couple of posts regarding the issue of not being able to find module google.cloud. In my case I am able to import automl_v1beta1 from google.cloud but not proto.data_types_pb2 from google.cloud.automl_v1beta1

racerX
  • 930
  • 9
  • 25

1 Answers1

0

I think you can:

from google.cloud import automl_v1beta1 as automl
import google.cloud.automl_v1beta1.types as data_types

Or:

import google.cloud.automl_v1beta1 as automl
import google.cloud.automl_v1beta1.types as data_types

But (!) given the import errors, there may be other changes to the SDK in the code that follows.

DazWilkin
  • 32,823
  • 5
  • 47
  • 88
  • Just to add, for the types reference see https://googleapis.dev/python/automl/latest/automl_v1beta1/types.html#module-google.cloud.automl_v1beta1.types – Ricco D Jul 28 '21 at 04:54
  • This ```google.cloud.automl_v1beta1.types``` module seems to be different from the ```google.cloud.automl_v1beta1.proto.data_types_pb2```. They use ```data_types.TypeCode.Name``` later on in the notebook, with ```google.cloud.automl_v1beta1.types``` I get ```AttributeError: Name``` – racerX Jul 28 '21 at 16:10
  • Yes, see my "there *may* be other changes to the SDK" comment... The type `TypeCode` exists in the package, it just doesn't appear to now have a `Name` method. I recommend you submit an issue to the repo: https://github.com/googleapis/python-automl/issues – DazWilkin Jul 28 '21 at 16:33