{"record":{"id":"a97cc1531ae28e71","repo":"mlflow/mlflow","slug":"vertex-ai-provider-requires-the-google-auth-packag","errorCode":null,"errorMessage":"Vertex AI provider requires the google-auth package. Install it with: pip install google-auth","messagePattern":"Vertex AI provider requires the google-auth package\\. Install it with: pip install google-auth","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"mlflow/gateway/providers/vertex_ai.py","lineNumber":233,"sourceCode":"        if self._model_type == \"claude\":\n            self._delegate = _VertexAIClaudeProvider(\n                config, self.vertex_config, self._get_credentials\n            )\n        elif self._model_type == \"maas\":\n            self._delegate = _VertexAIMaaSProvider(\n                config, self.vertex_config, self._get_credentials\n            )\n        else:\n            self._delegate = None\n\n    def _get_credentials(self):\n        \"\"\"Get Google Cloud credentials, caching them for reuse.\"\"\"\n        try:\n            import google.auth\n            import google.auth.transport.requests\n            from google.oauth2 import service_account\n        except ImportError:\n            raise ImportError(\n                \"Vertex AI provider requires the google-auth package. \"\n                \"Install it with: pip install google-auth\"\n            )\n\n        if self._cached_credentials is not None and self._cached_credentials.valid:\n            return self._cached_credentials\n\n        if creds_data := self.vertex_config.vertex_credentials:\n            try:\n                info = json.loads(creds_data)\n            except (json.JSONDecodeError, TypeError):\n                try:\n                    info = json.loads(Path(creds_data).read_text())\n                except Exception as e:\n                    raise ValueError(\n                        \"vertex_credentials must be a JSON string or path to a JSON file\"\n                    ) from e\n            credentials = service_account.Credentials.from_service_account_info(","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/gateway/providers/vertex_ai.py#L215-L251","documentation":"The Vertex AI provider needs the google-auth package to obtain OAuth credentials. If the import fails, it raises ImportError with instructions to install google-auth. This is a lazy optional-dependency check.","triggerScenarios":"Using a vertexai gateway route in an environment where google-auth is not installed, so `import google.auth` inside _get_credentials raises ImportError.","commonSituations":"MLflow skinny or minimal installs without the gateway extras, CI environments missing optional dependencies, or deploying the gateway to a fresh container without pip install 'mlflow[gateway]' extras.","solutions":["Install the missing package: pip install google-auth.","Install gateway extras: pip install 'mlflow[gateway]'.","If using uv, add google-auth to the environment dependencies.","Rebuild/redeploy the container image with google-auth included."],"exampleFix":"# before\npip install mlflow\n# after\npip install \"mlflow[gateway]\" google-auth","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec('google.auth') is None:\n    raise SystemExit(\"Install google-auth: pip install 'mlflow[gateway]' google-auth\")","typeGuard":null,"tryCatchPattern":"try:\n    headers = await provider.headers()\nexcept ImportError as e:\n    log.error('Optional dependency missing: %s', e)\n    # install google-auth and retry","preventionTips":["Include google-auth in deployment images that serve vertexai routes.","Install mlflow with gateway extras in CI and production.","Import-check optional dependencies at container startup."],"tags":["dependency","vertex-ai","import","gateway"],"backgroundTag":"missing-dependency","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}