{"record":{"id":"27d66dbc7191183c","repo":"cocoindex-io/cocoindex","slug":"google-auth-and-google-api-python-client-are-requi","errorCode":null,"errorMessage":"google-auth and google-api-python-client are required to use the Google Drive source. Please install cocoindex[google_drive].","messagePattern":"google-auth and google-api-python-client are required to use the Google Drive source\\. Please install cocoindex\\[google_drive\\]\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/google_drive/_source.py","lineNumber":23,"sourceCode":"\"\"\"\n\nfrom __future__ import annotations\n\nimport asyncio\nimport io\nfrom dataclasses import dataclass\nfrom datetime import datetime\nfrom pathlib import PurePath\nfrom typing import Any, AsyncIterator, Iterator, Sequence, Self\n\ntry:\n    import httplib2  # type: ignore\n    from google.oauth2.service_account import Credentials  # type: ignore\n    from google_auth_httplib2 import AuthorizedHttp  # type: ignore\n    from googleapiclient.discovery import build  # type: ignore\n    from googleapiclient.http import HttpRequest, MediaIoBaseDownload  # type: ignore\nexcept ImportError as e:\n    raise ImportError(\n        \"google-auth and google-api-python-client are required to use the Google Drive source. \"\n        \"Please install cocoindex[google_drive].\"\n    ) from e\n\nfrom cocoindex.resources import file\n\n\nclass DriveFilePath(file.FilePath[str]):\n    \"\"\"\n    File path for Google Drive files.\n\n    The resolved path is the Google Drive file ID (string).\n    \"\"\"\n\n    __slots__ = (\"_file_id\",)\n\n    _file_id: str\n","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/google_drive/_source.py#L5-L41","documentation":"The Google Drive source connector requires the optional google-auth and google-api-python-client packages. At import time the module tries to import them (httplib2, google.oauth2, googleapiclient); on ImportError it raises an instructive ImportError telling the user to install the cocoindex[google_drive] extra.","triggerScenarios":"Importing cocoindex.connectors.google_drive (or using its source) in an environment where cocoindex was installed without the google_drive extra, e.g. plain `pip install cocoindex`.","commonSituations":"Fresh deployment/CI environments missing optional extras; switching machines without reinstalling extras; Docker images built from base requirements only.","solutions":["Install the extra: pip install 'cocoindex[google_drive]' (or uv add 'cocoindex[google_drive]')","Install the packages directly: pip install google-auth google-auth-httplib2 google-api-python-client","Add cocoindex[google_drive] to your project's dependency list / requirements.txt"],"exampleFix":"// before\npip install cocoindex\n// after\npip install \"cocoindex[google_drive]\"","handlingStrategy":"fallback","validationCode":"import importlib.util\nif importlib.util.find_spec(\"googleapiclient\") is None:\n    raise SystemExit(\"Install: pip install 'cocoindex[google_drive]'\")","typeGuard":null,"tryCatchPattern":"try:\n    from cocoindex.connectors import google_drive\nexcept ImportError:\n    google_drive = None  # surface a friendly setup message","preventionTips":["Always install optional extras: cocoindex[google_drive]","Pin extras in requirements.txt/pyproject dependencies","Run a dependency smoke-test in CI that imports every connector used"],"tags":["google-drive","import","optional-dependency","installation"],"backgroundTag":"missing-optional-dependency","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}