apache/beam · error · ImportError

Google Cloud Video Intelligence not supported for this…

Error message

Google Cloud Video Intelligence not supported for this execution environment (could not import google.cloud.videointelligence).

What it means

Module-level guard in videointelligenceml.py: the google.cloud.videointelligence client library is not installed in this execution environment, so the AnnotateVideo connector cannot be imported at all.

Solutions

  1. pip install google-cloud-videointelligence
  2. Or install the bundled extra: pip install 'apache_beam[gcp]'
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at sdks/python/apache_beam/ml/gcp/videointelligenceml.py:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/b6b6baea97bb3b85. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/ml/gcp/videointelligenceml.py:34

#

"""A connector for sending API requests to the GCP Video Intelligence API."""

from typing import Optional
from typing import Union

from cachetools.func import ttl_cache

from apache_beam import typehints
from apache_beam.metrics import Metrics
from apache_beam.transforms import DoFn
from apache_beam.transforms import ParDo
from apache_beam.transforms import PTransform

try:
  from google.cloud import videointelligence
except ImportError:
  raise ImportError(
      'Google Cloud Video Intelligence not supported for this execution '
      'environment (could not import google.cloud.videointelligence).')

__all__ = ['AnnotateVideo', 'AnnotateVideoWithContext']


@ttl_cache(maxsize=128, ttl=3600)
def get_videointelligence_client():
  """Returns a Cloud Video Intelligence client."""
  _client = videointelligence.VideoIntelligenceServiceClient()
  return _client


class AnnotateVideo(PTransform):
  """A ``PTransform`` for annotating video using the GCP Video Intelligence API
  ref: https://cloud.google.com/video-intelligence/docs

  Sends each element to the GCP Video Intelligence API. Element is a

View on GitHub (pinned to 12126d8942)