Skip to content

Unable to deploy adk-python demo weather agent to Vertex AI #1004

@PratyushRaizada94

Description

@PratyushRaizada94

Describe the bug
Unable to deploy adk-python demo weather agent to Vertex AI. Getting below error message in Cloud Logging

DEFAULT 2025-05-28T19:25:14.852714Z [9] ERROR: Pickle load failed: Missing module. Service terminating. A required module, present when the agent object was pickled locally, is missing in the remote environment. Please ensure all necessary dependencies used by the agent object are included in `extra_packages` or `requirements.txt`, or remove unused but imported dependencies in the agent object. Traceback: Traceback (most recent call last):\n File "/code/app/api/factory/python_file_api_builder.py", line 893, in create_apis\n obj = utils.get_object(python_file_name)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/code/app/api/factory/utils.py", line 144, in get_object\n obj = get_local_object(obj_filename)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File "/code/app/api/factory/utils.py", line 163, in get_local_object\n return cloudpickle.loads(f.read())\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\nModuleNotFoundError: No module named 'agent'\n
  {
    "textPayload": "[9]       ERROR:    Pickle load failed: Missing module. Service terminating. A required module, present when the agent object was pickled locally, is missing in the remote environment. Please ensure all necessary dependencies used by the agent object are included in `extra_packages` or `requirements.txt`, or remove unused but imported dependencies in the agent object. Traceback: Traceback (most recent call last):\\n  File \"/code/app/api/factory/python_file_api_builder.py\", line 893, in create_apis\\n    obj = utils.get_object(python_file_name)\\n          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \"/code/app/api/factory/utils.py\", line 144, in get_object\\n    obj = get_local_object(obj_filename)\\n          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\n  File \"/code/app/api/factory/utils.py\", line 163, in get_local_object\\n    return cloudpickle.loads(f.read())\\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\\nModuleNotFoundError: No module named 'agent'\\n",
    "insertId": "[REDACTED_INSERT_ID]",
    "resource": {
      "type": "aiplatform.googleapis.com/ReasoningEngine",
      "labels": {
        "location": "us-central1",
        "resource_container": "[REDACTED_PROJECT_ID]",
        "reasoning_engine_id": "[REDACTED_ENGINE_ID]"
      }
    },
    "timestamp": "2025-05-28T19:25:14.852714Z",
    "logName": "projects/[REDACTED_PROJECT_NAME]/logs/aiplatform.googleapis.com%2Freasoning_engine_stderr",
    "receiveTimestamp": "2025-05-28T19:25:15.192247896Z"
  }

To Reproduce
Steps to reproduce the behavior:

  1. Install adk-python v0.0.5
  2. Follow the instruction to create the agent as described here.
  3. Run the agent using adk web (it works)
  4. Deploy the agent to Vertex AI using the guide here

Expected behavior
Agent should be created successfully.

Console Logs

/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/.venv/lib/python3.12/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Deploying google.adk.agents.Agent as an application.
Identified the following requirements: {'google-cloud-aiplatform': '1.94.0', 'cloudpickle': '3.1.1', 'pydantic': '2.11.5'}
Failed to parse constraint: -e /Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent. Exception: Expected package name at the start of dependency specifier
    -e /Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent
    ^
The following requirements are missing: {'cloudpickle'}
The following requirements are incompatible: {'pydantic==2.11.5 (required: ==2.11.3)'}
The following requirements are appended: {'cloudpickle==3.1.1'}
The final list of requirements: ['-e /Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent', 'google-cloud-aiplatform[adk,agent_engines]', 'aiohappyeyeballs==2.6.1', 'aiohttp==3.11.16', 'aiosignal==1.3.2', 'annotated-types==0.7.0', 'anyio==4.9.0', 'APScheduler==3.11.0', 'attrs==25.3.0', 'Authlib==1.5.2', 'backoff==2.2.1', 'boto3==1.34.34', 'botocore==1.34.162', 'cachetools==5.5.2', 'certifi==2025.1.31', 'cffi==1.17.1', 'charset-normalizer==3.4.1', 'click==8.1.8', 'cryptography==43.0.3', 'Deprecated==1.2.18', 'distro==1.9.0', 'dnspython==2.7.0', 'docstring_parser==0.16', 'email_validator==2.2.0', 'fastapi==0.115.12', 'fastapi-sso==0.16.0', 'filelock==3.18.0', 'frozenlist==1.5.0', 'fsspec==2025.3.2', 'google-adk==0.3.0', 'google-api-core==2.24.2', 'google-api-python-client==2.166.0', 'google-auth==2.38.0', 'google-auth-httplib2==0.2.0', 'google-cloud-bigquery==3.31.0', 'google-cloud-core==2.4.3', 'google-cloud-resource-manager==1.14.2', 'google-cloud-secret-manager==2.23.2', 'google-cloud-speech==2.31.1', 'google-cloud-storage==2.19.0', 'google-cloud-trace==1.16.1', 'google-crc32c==1.7.1', 'google-genai==1.12.1', 'google-resumable-media==2.7.2', 'googleapis-common-protos==1.69.2', 'graphviz==0.20.3', 'greenlet==3.1.1', 'grpc-google-iam-v1==0.14.2', 'grpcio==1.71.0', 'grpcio-status==1.71.0', 'gunicorn==23.0.0', 'h11==0.14.0', 'httpcore==1.0.8', 'httplib2==0.22.0', 'httpx==0.28.1', 'httpx-sse==0.4.0', 'huggingface-hub==0.30.2', 'idna==3.10', 'importlib_metadata==8.6.1', 'Jinja2==3.1.6', 'jiter==0.9.0', 'jmespath==1.0.1', 'jsonschema==4.23.0', 'jsonschema-specifications==2024.10.1', 'litellm==1.65.8', 'litellm-proxy-extras==0.1.3', 'MarkupSafe==3.0.2', 'mcp==1.5.0', 'multidict==6.4.3', 'numpy==2.2.4', 'oauthlib==3.2.2', 'openai==1.73.0', 'opentelemetry-api==1.32.0', 'opentelemetry-exporter-gcp-trace==1.9.0', 'opentelemetry-resourcedetector-gcp==1.9.0a0', 'opentelemetry-sdk==1.32.0', 'opentelemetry-semantic-conventions==0.53b0', 'orjson==3.10.16', 'packaging==24.2', 'propcache==0.3.1', 'proto-plus==1.26.1', 'protobuf==5.29.4', 'pyasn1==0.6.1', 'pyasn1_modules==0.4.2', 'pycparser==2.22', 'pydantic==2.11.3', 'pydantic-settings==2.8.1', 'pydantic_core==2.33.1', 'PyJWT==2.10.1', 'PyNaCl==1.5.0', 'pyparsing==3.2.3', 'python-dateutil==2.9.0.post0', 'python-dotenv==1.1.0', 'python-multipart==0.0.18', 'PyYAML==6.0.2', 'redis==5.2.1', 'referencing==0.36.2', 'regex==2024.11.6', 'requests==2.32.3', 'rpds-py==0.24.0', 'rq==2.3.1', 'rsa==4.9', 's3transfer==0.10.4', 'shapely==2.1.0', 'six==1.17.0', 'sniffio==1.3.1', 'SQLAlchemy==2.0.40', 'sse-starlette==2.2.1', 'starlette==0.46.1', 'tiktoken==0.9.0', 'tokenizers==0.21.1', 'tqdm==4.67.1', 'typing-inspection==0.4.0', 'typing_extensions==4.13.2', 'tzlocal==5.3.1', 'uritemplate==4.1.1', 'urllib3==2.4.0', 'uvicorn==0.34.2', 'uvloop==0.21.0', 'websockets==13.1', 'wrapt==1.17.2', 'yarl==1.19.0', 'zipp==3.21.0', 'cloudpickle==3.1.1']
/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/.venv/lib/python3.12/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/.venv/lib/python3.12/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Using bucket [REDACTED_BUCKET_NAME]
Wrote to gs://[REDACTED_BUCKET_NAME]/agent_engine/agent_engine.pkl
Writing to gs://[REDACTED_BUCKET_NAME]/agent_engine/requirements.txt
Creating in-memory tarfile of extra_packages
Writing to gs://[REDACTED_BUCKET_NAME]/agent_engine/dependencies.tar.gz
Creating AgentEngine
Create AgentEngine backing LRO: projects/[REDACTED_PROJECT_ID]/locations/us-central1/reasoningEngines/[REDACTED_ENGINE_ID]/operations/[REDACTED_OPERATION_ID]
View progress and logs at https://console.cloud.google.com/logs/query?project=[REDACTED_PROJECT_NAME]
Traceback (most recent call last):
  File "/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/multi_tool_agent/deploy.py", line 160, in <module>
    remote_app = agent_engines.create(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/.venv/lib/python3.12/site-packages/vertexai/agent_engines/__init__.py", line 147, in create
    return AgentEngine.create(
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/.venv/lib/python3.12/site-packages/vertexai/agent_engines/_agent_engines.py", line 528, in create
    created_resource = operation_future.result()
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/[REDACTED_USER]/Projects/adk-demo-projects/adk-weather-agent/.venv/lib/python3.12/site-packages/google/api_core/future/polling.py", line 261, in result
    raise self._exception
google.api_core.exceptions.InvalidArgument: 400 Build failed. The issue might be caused by incorrect code, requirements.txt file or other dependencies.
 Please refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/deploy) for checking logs and other troubleshooting tips. 3: Build failed. The issue might be caused by incorrect code, requirements.txt file or other dependencies.
 Please refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/deploy) for checking logs and other troubleshooting tips.
((.venv) ) [REDACTED_USER]@[REDACTED_HOST] adk-weather-agent %

Desktop (please complete the following information):

  • OS: MacOS
  • Python version(python -V): Python 3.12.10
  • ADK version(pip show google-adk): 0.0.5

Additional context

Directory structure

adk-weather-agent % tree
.
├── README.md
├── example_usage.py
├── multi_tool_agent
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-312.pyc
│   │   ├── agent.cpython-312.pyc
│   │   └── deploy.cpython-312.pyc
│   ├── agent.py
│   ├── deploy.py
└── requirements.txt

Command used to deploy

python3 multi_tool_agent/deploy.py

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementation

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions