Compatibility with GCP aiplatform, bigquery and cloud-storage on hyperparameter tuning docker image

Viewed 21

I am doing hyperparameter tuning on GCP using this scikit docker image. When I add the aiplatform package as a dependency, things break. The error comes from the bigquery import.

from google.cloud import bigquery

The error message is below.

The replica workerpool0-0 exited with a non-zero status of 1. 
 Traceback (most recent call last):
   [...]
   File "/root/.local/lib/python3.7/site-packages/trainer/task.py", line 7, in 
     from google.cloud import storage, bigquery
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/__init__.py", line 35, in 
     from google.cloud.bigquery.client import Client
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/client.py", line 60, in 
     from google.cloud.bigquery import _pandas_helpers
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/_pandas_helpers.py", line 40, in 
     from google.cloud.bigquery import schema
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery/schema.py", line 19, in 
     from google.cloud.bigquery_v2 import types
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery_v2/__init__.py", line 23, in 
     from google.cloud.bigquery_v2 import types
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery_v2/types.py", line 23, in 
     from google.cloud.bigquery_v2.proto import encryption_config_pb2
   File "/usr/local/lib/python3.7/dist-packages/google/cloud/bigquery_v2/proto/encryption_config_pb2.py", line 64, in 
     file=DESCRIPTOR,
   File "/root/.local/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 560, in __new__
     _message.Message._CheckCalledFromGeneratedFile()
 TypeError: Descriptors cannot not be created directly.
 If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
 If you cannot immediately regenerate your protos, some other possible workarounds are:
  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

From the logs, I can see the system is downloading google-cloud-aiplatform v1.17.0. According to the scikit docker image, google-cloud-storage v1.35.0 is installed, but google-cloud-aiplatform drags in v2.5.0.

I am thinking I need to downgrade google-cloud-aiplatform to a specific version. Anyone know which version or how to resolve this problem?

UPDATE: FWIW, if I downgrade google-cloud-aiplatform==1.15.1 then the problem above goes away. However, this problem below shows.

Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/root/.local/lib/python3.7/site-packages/trainer/hpt.py", line 170, in 
    staging_bucket=f'{args.bucket_uri}'
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/initializer.py", line 138, in init
    backing_tensorboard=experiment_tensorboard,
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/metadata/metadata.py", line 235, in set_experiment
    experiment_name=experiment, description=description
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/metadata/experiment_resources.py", line 247, in get_or_create
    project=project, location=location, credentials=credentials
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/metadata/metadata_store.py", line 283, in ensure_default_metadata_store_exists
    encryption_spec_key_name=encryption_key_spec_name,
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/metadata/metadata_store.py", line 123, in get_or_create
    credentials=credentials,
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/metadata/metadata_store.py", line 241, in _get
    credentials=credentials,
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/metadata/metadata_store.py", line 73, in __init__
    self._gca_resource = self._get_gca_resource(resource_name=metadata_store_name)
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/base.py", line 617, in _get_gca_resource
    return getattr(self.api_client, self._getter_method)(
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/utils/__init__.py", line 425, in __getattr__
    return getattr(self._clients[self._default_version], name)
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform/utils/__init__.py", line 359, in __getattr__
    client_info=self._client_info,
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform_v1/services/metadata_service/client.py", line 547, in __init__
    api_audience=client_options.api_audience,
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py", line 190, in __init__
    ("grpc.max_receive_message_length", -1),
  File "/root/.local/lib/python3.7/site-packages/google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py", line 241, in create_channel
    **kwargs,
  File "/root/.local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 318, in create_channel
    default_host=default_host,
  File "/root/.local/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 239, in _create_composite_credentials
    credentials, scopes=scopes, default_scopes=default_scopes
TypeError: with_scopes_if_required() got an unexpected keyword argument 'default_scopes'
0 Answers
Related