Search code examples
google-cloud-platformgoogle-cloud-vertex-ai

Why do I get 'google.cloud.aiplatform.constants' has no attribute 'SUPPORTED_REGIONS error for Vertex AI init?


I am trying to set up mlops for Vertex AI, following this notebook. It works until, near the end, I try:

vertex_ai.init(
project=PROJECT,
    location=REGION)

which gives:

 module 'google.cloud.aiplatform.constants' has no attribute 'SUPPORTED_REGIONS

I am using us-central1 which is supported. I wondered if maybe from google.cloud import aiplatform as vertex_ai has been changed but don't know how to find out. Any help is much appreciated.


Solution

  • I followed the same Notebook as you, even though I didn't have any issue. What could be happening to you is that you are using an older version of the library.

    You can use the command to upgrade the library that is the following one: pip3 install google-cloud-aiplatform --upgrade.

    Sometimes this happens with the basic installation of the library; the problems could be in the dependencies, versions and indirectly permissions.