adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

ADK build on Cloud Run skips indirect dependencies declared in pyproject.toml

Open smithakolan opened this issue 1 year ago • 2 comments

When deploying an ADK agent to Cloud Run using a pyproject.toml (instead of a requirements.txt), dependency resolution fails to install all indirect dependencies. In particular, langchain_core is not installed even though it is required by langchain-community, resulting in this runtime error:

ModuleNotFoundError: No module named langchain_core

To Reproduce

Create a minimal ADK project with the following pyproject.toml: ` [project] name = "zoo-guide-agent" version = "0.1.0" description = "Example of deploying an ADK agent on Cloud Run" requires-python = ">=3.12"

dependencies = [ "google-adk==1.14.0", "langchain-community==0.3.27", "wikipedia==1.4.0" ] `

Deploy directly to Cloud Run:

# Run the deployment command
uvx --from google-adk \
adk deploy cloud_run \
  --project=$PROJECT_ID \
  --region=europe-west1 \
  --service_name=zoo-tour-guide \
  --with_ui \
  . \
  -- \
  --labels=dev-tutorial=codelab-adk \
  --service-account=$SERVICE_ACCOUNT

Error:

ModuleNotFoundError: No module named 'langchain_core'

Expected behavior Cloud Run should correctly resolve and install all dependencies declared in pyproject.toml, including indirect dependencies like langchain_core, without requiring a requirements.txt file or manual additions.

Additional context

The issue is specific to Cloud Run’s buildpack environment.

It does not occur if a requirements.txt is used instead of pyproject.toml.

Manually pinning langchain-core==0.3.27 or deploying with --no-cache-dir temporarily resolves the issue.

This suggests that ADK or the Cloud Build environment might not fully support dependency resolution from pyproject.toml files yet.

smithakolan avatar Oct 28 '25 20:10 smithakolan

@smithakolan Thanks for reporting the issue! I have reproduced successfully Follow this steps ,Please open your project’s pyproject.toml file and locate the project section. Under the dependencies list, add langchain-core as a direct dependency so Cloud Run installs it explicitly. The dependencies section should look like this:

dependencies = [
  "google-adk==1.14.0",
  "langchain-community==0.3.27",
  "langchain-core==0.3.27",  # Add this line
  "wikipedia==1.4.0"
]

After that, make sure this part is followed by the build system configuration:

[build-system]
requires = ["hatchling>=1.8"]
build-backend = "hatchling.build"

Thanks!

klateefa avatar Nov 05 '25 16:11 klateefa

Closing this issue as there hasn't been any recent activity.

llalitkumarrr avatar Feb 09 '26 13:02 llalitkumarrr