{"record":{"id":"c3f80f8c0e81390f","repo":"apache/beam","slug":"google-cloud-vision-not-supported-for-this-execution","errorCode":null,"errorMessage":"Google Cloud Vision not supported for this execution environment (could not import google.cloud.vision).","messagePattern":"Google Cloud Vision not supported for this execution environment \\(could not import google\\.cloud\\.vision\\)\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/gcp/visionml.py","lineNumber":39,"sourceCode":"\"\"\"\n\nfrom typing import Optional\nfrom typing import Union\n\nfrom cachetools.func import ttl_cache\n\nfrom apache_beam import typehints\nfrom apache_beam.metrics import Metrics\nfrom apache_beam.transforms import DoFn\nfrom apache_beam.transforms import FlatMap\nfrom apache_beam.transforms import ParDo\nfrom apache_beam.transforms import PTransform\nfrom apache_beam.transforms import util\n\ntry:\n  from google.cloud import vision\nexcept ImportError:\n  raise ImportError(\n      'Google Cloud Vision not supported for this execution environment '\n      '(could not import google.cloud.vision).')\n\n__all__ = [\n    'AnnotateImage',\n    'AnnotateImageWithContext',\n]\n\n\n@ttl_cache(maxsize=128, ttl=3600)\ndef get_vision_client(client_options=None):\n  \"\"\"Returns a Cloud Vision API client.\"\"\"\n  _client = vision.ImageAnnotatorClient(client_options=client_options)\n  return _client\n\n\nclass AnnotateImage(PTransform):\n  \"\"\"A ``PTransform`` for annotating images using the GCP Vision API.","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/gcp/visionml.py#L21-L57","documentation":"Module-level guard in visionml.py: importing google.cloud.vision failed, so the Cloud Vision annotation transform is unavailable. This happens before any pipeline construction, typically in worker images missing the GCP extras.","triggerScenarios":"Thrown at sdks/python/apache_beam/ml/gcp/visionml.py:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["pip install google-cloud-vision","Or install the bundled extra: pip install 'apache_beam[gcp]'"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}