Skip to content

ModuleNotFoundError hit when run the A2A client for ADK agent #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zzxwill opened this issue Apr 20, 2025 · 1 comment · May be fixed by #245
Open

ModuleNotFoundError hit when run the A2A client for ADK agent #243

zzxwill opened this issue Apr 20, 2025 · 1 comment · May be fixed by #245

Comments

@zzxwill
Copy link

zzxwill commented Apr 20, 2025

I started ADK agent by following the guide and it worked.

➜  google_adk git:(main) ✗ uv run .
INFO:     Started server process [27657]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://localhost:10002 (Press CTRL+C to quit)

By when I In a separate terminal, run the A2A client:, the ADK agent itself hit an issue as below.

# Connect to the agent (specify the agent URL with correct port)
uv run hosts/cli --agent http://localhost:10002
➜  google_adk git:(main) ✗ uv run .
INFO:     Started server process [27657]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://localhost:10002 (Press CTRL+C to quit)
INFO:     ::1:49322 - "GET /.well-known/agent.json HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/anyio/_core/_eventloop.py", line 162, in get_async_backend
KeyError: 'asyncio'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/applications.py", line 112, in __call__
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 187, in __call__
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/middleware/errors.py", line 165, in __call__
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/routing.py", line 714, in __call__
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/routing.py", line 734, in app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/routing.py", line 288, in handle
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/routing.py", line 76, in app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/routing.py", line 73, in app
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/starlette/concurrency.py", line 37, in run_in_threadpool
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/anyio/to_thread.py", line 56, in run_sync
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/anyio/_core/_eventloop.py", line 164, in get_async_backend
  File "/opt/homebrew/Cellar/[email protected]/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'anyio._backends'
zzxwill pushed a commit to zzxwill/A2A that referenced this issue Apr 20, 2025
This commit adds the `anyio` library as a dependency with a minimum version of 4.9.0. The addition is necessary to ensure compatibility with asynchronous operations in the project, which rely on `anyio` for managing asynchronous tasks and concurrency.

Fix google#243
zzxwill added a commit to zzxwill/A2A that referenced this issue Apr 20, 2025
This commit adds the anyio library as a dependency with a minimum version of 4.9.0. The addition is necessary to ensure compatibility with asynchronous operations in the project, which rely on anyio for managing asynchronous tasks and concurrency.

Fix google#243
@zzxwill zzxwill linked a pull request Apr 20, 2025 that will close this issue
@darkhaniop
Copy link
Contributor

On my machine, the ADK agent responds as expected:

samples/python/agents/google_adk$ uv run .
INFO:     Started server process [518654]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://localhost:10002 (Press CTRL+C to quit)
INFO:     ::1:52040 - "GET /.well-known/agent.json HTTP/1.1" 200 OK

Also, from this line, it looks like anyio is present in your environment:

Traceback (most recent call last):
  File "/Users/bytedance/Programming/golang/src/google/A2A/samples/python/.venv/lib/python3.13/site-packages/anyio/_core/_eventloop.py", line 162, in get_async_backend
KeyError: 'asyncio'

Which is expected since it's in the dependency trees of other packages listed in pyproject.toml.

And from the last line:

ModuleNotFoundError: No module named 'anyio._backends'

It looks like for some reason it cannot find its own submodule anyio._backends at
.venv/lib/python3.13/site-packages/anyio/_backends?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants