{"id":296,"library":"googleapis-common-protos","title":"Google APIs Common Protos","description":"The 'googleapis-common-protos' library provides common protocol buffer types used across various Google APIs. The current version is 1.73.1, released on March 28, 2026. The library is actively maintained with regular updates to ensure compatibility and feature enhancements.","status":"active","version":"1.73.1","language":"python","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/googleapis-common-protos","tags":["Google APIs","Protocol Buffers","Protobuf","API","Serialization"],"install":[{"cmd":"pip install googleapis-common-protos","lang":"bash","label":"Install googleapis-common-protos"}],"dependencies":[{"reason":"Required for protocol buffer support","package":"protobuf","optional":false}],"imports":[{"note":"Direct import may fail; use the 'from' syntax for proper module resolution.","wrong":"import google.rpc.error_details_pb2","symbol":"error_details_pb2","correct":"from google.rpc import error_details_pb2"}],"quickstart":{"code":"from google.rpc import error_details_pb2\n\n# Create an instance of a common error detail message\ndetail = error_details_pb2.DebugInfo()\ndetail.detail = 'Detailed error information'\n\n# Serialize the message to a string\nserialized_detail = detail.SerializeToString()\n\n# Deserialize the string back to a message\nnew_detail = error_details_pb2.DebugInfo()\nnew_detail.ParseFromString(serialized_detail)\n\nprint(new_detail.detail)","lang":"python","description":"This example demonstrates how to create, serialize, and deserialize a common error detail message using the 'googleapis-common-protos' library."},"warnings":[{"fix":"Pin to 'googleapis-common-protos<1.67.0' or ensure that your build process does not depend on the presence of .proto files in the package.","message":"Version 1.67.0 removed .proto files from wheels, causing issues for users relying on these files for building Python Protobuf bindings.","severity":"breaking","affected_versions":"1.67.0"},{"fix":"Downgrade 'protobuf' to a version below 4.21.5 to maintain compatibility.","message":"Incompatibility with 'protobuf' versions 4.21.5 and above, leading to import errors in dependent packages.","severity":"breaking","affected_versions":"protobuf>=4.21.5"},{"fix":"Use the 'from' syntax for imports, e.g., 'from google.rpc import error_details_pb2'.","message":"Importing modules directly without the 'from' syntax may lead to import errors due to module resolution issues.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-05-12T12:54:55.326Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Install the `protobuf` package: `pip install protobuf` (or `pip install googleapis-common-protos` which will install `protobuf` as a dependency). Consider using a virtual environment.","cause":"The `protobuf` library, which `googleapis-common-protos` depends on for serialization and deserialization of structured data, is not installed or not correctly recognized in your Python environment.","error":"ModuleNotFoundError: No module named 'google.protobuf'"},{"fix":"Ensure `protobuf` is correctly installed. It often helps to reinstall both packages in a clean virtual environment: `pip uninstall protobuf googleapis-common-protos` followed by `pip install googleapis-common-protos`.","cause":"This error typically occurs when the `protobuf` runtime library's generated Python files (`_pb2.py`), including `descriptor_pb2.py`, are either not properly built, corrupted, or cannot be found by Python, often due to an incomplete or problematic `protobuf` installation or a namespace conflict.","error":"ImportError: cannot import name 'descriptor_pb2'"},{"fix":"Ensure both `googleapis-common-protos` and `protobuf` are up-to-date and installed using `pip` to resolve potential namespace issues: `pip install --upgrade googleapis-common-protos protobuf`.","cause":"This specific import error, particularly when trying to import a `_pb2` file (e.g., `distribution_pb2`) from `google.api`, can arise from version conflicts between `googleapis-common-protos` (especially versions 1.62 or later) and older `protobuf` versions, or when installing with `setup.py` instead of `pip`, which can interfere with proper namespace package creation.","error":"ModuleNotFoundError: No module named 'google.api'"},{"fix":"You need to provide `protoc` with the path to the `google/api` `.proto` files. This often involves obtaining the `googleapis` repository (e.g., from GitHub) and including its path: `protoc -I. -I/path/to/downloaded/googleapis --python_out=. my_service.proto` (where `/path/to/downloaded/googleapis` contains the `google/api` directory).","cause":"When using `protoc` (the Protocol Buffer compiler) to compile your `.proto` files that import common Google API protos (like `google/api/annotations.proto`), `protoc` cannot locate the necessary `.proto` source files. This can happen if the `googleapis-common-protos` Python package was installed without its `.proto` files (an issue in some older versions) or if the `--proto_path` argument is not correctly configured to point to the directory containing these Google API `.proto` definitions.","error":"Import \"google/api/annotations.proto\" was not found or had errors."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.15,"mem_mb":3.8,"disk_size":"20.9M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.06,"mem_mb":2.5,"disk_size":"22M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.51,"mem_mb":4,"disk_size":"23.2M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.07,"mem_mb":2.8,"disk_size":"24M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.42,"mem_mb":3.9,"disk_size":"15.1M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.08,"mem_mb":2.7,"disk_size":"16M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.39,"mem_mb":3.8,"disk_size":"14.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.06,"mem_mb":2.5,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.1,"mem_mb":3.7,"disk_size":"20.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.04,"mem_mb":2.5,"disk_size":"21M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}