{"record":{"id":"af8da4bafcc229c0","repo":"BerriAI/litellm","slug":"vertexai-import-failed-please-run-pip-install-goo","errorCode":null,"errorMessage":"vertexai import failed please run `pip install google-cloud-aiplatform`. This is required for the 'vertex_ai/' route on LiteLLM","messagePattern":"vertexai import failed please run `pip install google-cloud-aiplatform`\\. This is required for the 'vertex_ai/' route on LiteLLM","errorType":"exception","errorClass":"VertexAIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/vertex_ai/vertex_ai_non_gemini.py","lineNumber":101,"sourceCode":"    vertex_project=None,\n    vertex_location=None,\n    vertex_credentials=None,\n    litellm_params=None,\n    logger_fn=None,\n    acompletion: bool = False,\n):\n    \"\"\"\n    NON-GEMINI/ANTHROPIC CALLS.\n\n    This is the handler for OLDER PALM MODELS and VERTEX AI MODEL GARDEN\n\n    For Vertex AI Anthropic: `vertex_anthropic.py`\n    For Gemini: `vertex_httpx.py`\n    \"\"\"\n    try:\n        import vertexai\n    except Exception:\n        raise VertexAIError(\n            status_code=400,\n            message=\"vertexai import failed please run `pip install google-cloud-aiplatform`. This is required for the 'vertex_ai/' route on LiteLLM\",\n        )\n\n    if not (hasattr(vertexai, \"preview\") or hasattr(vertexai.preview, \"language_models\")):\n        raise VertexAIError(\n            status_code=400,\n            message=\"\"\"Upgrade vertex ai. Run `pip install \"google-cloud-aiplatform>=1.38\"`\"\"\",\n        )\n    try:\n        import google.auth\n        from google.cloud import aiplatform\n        from google.cloud.aiplatform_v1beta1.types import (\n            content as gapic_content_types,\n        )\n        from google.protobuf import json_format\n        from google.protobuf.struct_pb2 import Value\n        from vertexai.language_models import CodeGenerationModel, TextGenerationModel","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/vertex_ai_non_gemini.py#L83-L119","documentation":"VertexAIError (400) raised when 'import vertexai' fails in the non-Gemini handler (legacy PaLM / Model Garden route). The SDK simply is not installed in the environment, and the message gives the install command.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/vertex_ai_non_gemini.py:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the Vertex AI SDK: pip install google-cloud-aiplatform.","Ensure the package is installed into the same environment/interpreter that runs litellm, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}