{"record":{"id":"ccf5e5b1b7534090","repo":"apache/beam","slug":"google-cloud-natural-language-api-not-supported-for-this","errorCode":null,"errorMessage":"Google Cloud Natural Language API not supported for this execution environment (could not import Natural Language API client).","messagePattern":"Google Cloud Natural Language API not supported for this execution environment \\(could not import Natural Language API client\\)\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/gcp/naturallanguageml.py","lineNumber":30,"sourceCode":"# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nfrom typing import Mapping\nfrom typing import Optional\nfrom typing import Sequence\nfrom typing import Union\n\nimport apache_beam as beam\nfrom apache_beam.metrics import Metrics\n\ntry:\n  from google.cloud import language\n  from google.cloud import language_v1\nexcept ImportError:\n  raise ImportError(\n      'Google Cloud Natural Language API not supported for this execution '\n      'environment (could not import Natural Language API client).')\n\n__all__ = ['Document', 'AnnotateText']\n\n\nclass Document(object):\n  \"\"\"Represents the input to :class:`AnnotateText` transform.\n\n  Args:\n    content (str): The content of the input or the Google Cloud Storage URI\n      where the file is stored.\n    type (`Union[str, google.cloud.language_v1.Document.Type]`): Text type.\n      Possible values are `HTML`, `PLAIN_TEXT`. The default value is\n      `PLAIN_TEXT`.\n    language_hint (`Optional[str]`): The language of the text. If not specified,\n      language will be automatically detected. Values should conform to\n      ISO-639-1 standard.","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/gcp/naturallanguageml.py#L12-L48","documentation":"Module-level guard in naturallanguageml.py: importing the Google Cloud Natural Language client library failed, so none of the module's transforms can run in this environment. The error fires at import time, before any pipeline code executes.","triggerScenarios":"Thrown at sdks/python/apache_beam/ml/gcp/naturallanguageml.py:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the extra: pip install 'apache_beam[gcp]'","Or install the client directly: pip install google-cloud-language","Verify the install with: python -c 'from google.cloud import language_v1'"],"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"}