Google Cloud AutoML Client Library
raw JSON →The `google-cloud-automl` Python client library provides programmatic access to the Google Cloud AutoML API, enabling developers to train high-quality machine learning models tailored to specific business needs without extensive ML expertise. It leverages Google's state-of-the-art transfer learning and Neural Architecture Search technology. Currently at version 2.18.1, the library follows a frequent release cadence, typical of Google Cloud client libraries, with new versions often published weekly or bi-weekly. While functional, Google strongly recommends migrating to the Vertex AI SDK (`google-cloud-aiplatform`) for new development, as Vertex AI represents the next generation of Google's AI platform with enhanced features and MLOps capabilities.
pip install google-cloud-automl Common errors
error ModuleNotFoundError: No module named 'google.cloud.automl_v1beta1' ↓
pip install --upgrade google-cloud-automl. Ensure you are running this command in the correct virtual environment if you are using one. error Request had invalid authentication credentials. ↓
GOOGLE_APPLICATION_CREDENTIALS environment variable is set to the path of a valid service account key JSON file, and that the associated service account has the AutoML Editor IAM role or equivalent permissions. error The AutoML API is deprecated. Planned removal date is September 30, 2025. ↓
google-cloud-aiplatform) to leverage enhanced features and MLOps capabilities, as recommended by Google. error ValueError: Protocol message Dataset has no "tables_dataset_metadata" field. ↓
google-cloud-automl library to the latest version: pip install --upgrade google-cloud-automl. This ensures you have the most up-to-date API definitions and features. Warnings
deprecated Google strongly recommends migrating to the Vertex AI SDK for Python (`google-cloud-aiplatform`) for new machine learning development. The `google-cloud-automl` library primarily targets an older generation of AutoML tools. While this library remains functional, future feature development, enhanced capabilities, and the best user experience are focused within Vertex AI. ↓
breaking This library requires Python >= 3.7. Versions prior to 3.7 are not supported. Specifically, the last version compatible with Python 3.6 is `google-cloud-automl==2.7.3`, and Python 2.7 support ended with `google-cloud-automl==1.0.1`. ↓
gotcha Proper authentication and IAM permissions are crucial for interacting with the AutoML API. Common issues include the AutoML API not being enabled in the Google Cloud project, an incorrect service account lacking necessary roles (e.g., `roles/automl.editor`), or the `GOOGLE_APPLICATION_CREDENTIALS` environment variable not being correctly set to point to your service account key file. This is especially prone to error in non-standard execution environments like Jupyter notebooks. ↓
Install compatibility verified last tested: 2026-05-12
Imports
- AutoMlClient
from google.cloud import automl_v1 client = automl_v1.AutoMlClient()
Quickstart verified last tested: 2026-04-24
import os
from google.cloud import automl_v1
from google.api_core.exceptions import GoogleAPIError
def list_automl_datasets(project_id: str, location: str):
"""Lists all AutoML datasets for a given project and location."""
try:
client = automl_v1.AutoMlClient()
project_location = f"projects/{project_id}/locations/{location}"
print(f"Listing datasets for project '{project_id}' in location '{location}'...")
datasets = client.list_datasets(parent=project_location)
found_datasets = False
for dataset in datasets:
found_datasets = True
print(f"- Dataset name: {dataset.display_name} (ID: {dataset.name.split('/')[-1]})")
print(f" Full Resource Name: {dataset.name}")
print(f" State: {automl_v1.Dataset.State(dataset.example_count_state).name}")
print(f" Creation Time: {dataset.create_time.strftime('%Y-%m-%d %H:%M:%S UTC')}")
if not found_datasets:
print("No datasets found.")
except GoogleAPIError as e:
print(f"An API error occurred: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
project_id = os.environ.get("GOOGLE_CLOUD_PROJECT")
location = os.environ.get("GOOGLE_CLOUD_LOCATION", "us-central1") # Default location
if not project_id:
print("Error: GOOGLE_CLOUD_PROJECT environment variable not set.")
print("Please set it to your Google Cloud project ID.")
else:
list_automl_datasets(project_id, location)