Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No module named 'enterprise' #414

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

Closed
nneverwei opened this issue Apr 27, 2025 · 8 comments
Closed

No module named 'enterprise' #414

nneverwei opened this issue Apr 27, 2025 · 8 comments
Labels
models Issues about model support
Milestone

Comments

@nneverwei
Copy link
Contributor

Describe the bug
Using adk v0.3.0 + litellm v1.67.4 (latest), no interaction with any agent can be performed in adk web. An exception is thrown: "No module named 'enterprise'".

Last week should have been normal, but after updating adk and litellm to the latest version, it became abnormal.

To Reproduce
Steps to reproduce the behavior:

  1. Direct new environment pip install adk pip install litellm
  2. Follow the official example weather_time_agent,Modify the model to connect to litellm:
model=LiteLlm(
      model="openai/Qwen/Qwen2.5-72B-Instruct", 
      base_url="https://api.siliconflow.cn/v1", 
      api_key="***"
  ),
  1. run adk web,Error occurred "No module named 'enterprise'"

Screenshots
Image

Exception stack

2025-04-27 17:42:32,617 - INFO - envs.py:54 - No .env file found for mcp_file_v2_agent
2025-04-27 17:42:32,680 - ERROR - fast_api.py:637 - Error in event_generator: No module named 'enterprise'
Traceback (most recent call last):
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 625, in event_generator    
    runner = await _get_runner_async(req.app_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 796, in _get_runner_async  
    root_agent = await _get_root_agent_async(app_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 773, in _get_root_agent_async
    agent_module = importlib.import_module(app_name)
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\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 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "D:\code\test_adk\mcp_file_v2_agent\__init__.py", line 1, in <module>
    from . import agent
  File "D:\code\test_adk\mcp_file_v2_agent\agent.py", line 1, in <module>
    from google.adk.models.lite_llm import LiteLlm
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\models\lite_llm.py", line 31, in <module>
    from litellm import acompletion
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\litellm\__init__.py", line 1058, in <module>
    from .responses.main import *
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\litellm\responses\main.py", line 13, in <module>
    from litellm.responses.litellm_completion_transformation.handler import (
        LiteLLMCompletionTransformationHandler,
    )
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\litellm\responses\litellm_completion_transformation\handler.py", line 8, in <module>
    from litellm.responses.litellm_completion_transformation.streaming_iterator import (
        LiteLLMCompletionStreamingIterator,
    )
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\litellm\responses\litellm_completion_transformation\streaming_iterator.py", line 5, in <module>
    from litellm.responses.litellm_completion_transformation.transformation import (
        LiteLLMCompletionResponsesConfig,
    )
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\litellm\responses\litellm_completion_transformation\transformation.py", line 9, in <module>
    from enterprise.enterprise_hooks.session_handler import (
    ...<2 lines>...
    )
ModuleNotFoundError: No module named 'enterprise'

Desktop :

  • OS: windows11
  • Python version: 3.13.3
  • ADK version: 0.3.0
  • Litellm version: 1.67.4(latest)
@nneverwei
Copy link
Contributor Author

It is likely a problem with the latest version of Litellm (v1.67). By downgrading litellm to v1.66, this issue can be circumvented.

However, after the downgrade, another exception will occur in the adk0.3.0 itself and the adk web under the mcp_tool example.
RuntimeError: error getting root agent,

Attempting to connect to MCP Filesystem server...
2025-04-27 18:13:26,487 - ERROR - fast_api.py:637 - Error in event_generator: error getting root agent, 
Traceback (most recent call last):
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\mcp\client\stdio\win32.py", line 72, in create_windows_process
    process = await anyio.open_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\anyio\_core\_subprocesses.py", line 190, in open_process     
    return await get_async_backend().open_process(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\anyio\_backends\_asyncio.py", line 2561, in open_process     
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\asyncio\subprocess.py", line 224, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        stderr=stderr, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\asyncio\base_events.py", line 1788, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        protocol, popen_args, False, stdin, stdout, stderr,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        bufsize, **kwargs)
        ^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\asyncio\base_events.py", line 533, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 782, in _get_root_agent_async
    agent, exit_stack = await root_agent
                        ^^^^^^^^^^^^^^^^
  File "D:\code\test_adk\mcp_file_v2_agent\agent.py", line 28, in create_agent
    tools, exit_stack = await get_tools_async()
                        ^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\code\test_adk\mcp_file_v2_agent\agent.py", line 9, in get_tools_async
    tools, exit_stack = await MCPToolset.from_server(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<10 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py", line 223, in from_server
    await async_exit_stack.enter_async_context(toolset)
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\contextlib.py", line 668, in enter_async_context
    result = await _enter(cm)
             ^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py", line 258, in __aenter__
    raise e
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py", line 255, in __aenter__
    await self._initialize()
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py", line 229, in _initialize
    self.session = await self.session_manager.create_session()
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\tools\mcp_tool\mcp_session_manager.py", line 132, in create_session
    return await MCPSessionManager.initialize_session(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\tools\mcp_tool\mcp_session_manager.py", line 173, in initialize_session
    transports = await exit_stack.enter_async_context(client)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\contextlib.py", line 668, in enter_async_context
    result = await _enter(cm)
             ^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\mcp\client\stdio\__init__.py", line 113, in stdio_client     
    process = await _create_platform_compatible_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\mcp\client\stdio\__init__.py", line 210, in _create_platform_compatible_process
    process = await create_windows_process(command, args, env, errlog, cwd)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\mcp\client\stdio\win32.py", line 85, in create_windows_process
    process = await anyio.open_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
        [command, *args], env=env, stderr=errlog, cwd=cwd
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\anyio\_core\_subprocesses.py", line 190, in open_process     
    return await get_async_backend().open_process(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\anyio\_backends\_asyncio.py", line 2561, in open_process     
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\asyncio\subprocess.py", line 224, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        stderr=stderr, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\asyncio\base_events.py", line 1788, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        protocol, popen_args, False, stdin, stdout, stderr,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        bufsize, **kwargs)
        ^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\asyncio\base_events.py", line 533, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 625, in event_generator    
    runner = await _get_runner_async(req.app_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 796, in _get_runner_async  
    root_agent = await _get_root_agent_async(app_name)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\google\adk\cli\fast_api.py", line 786, in _get_root_agent_async
    raise RuntimeError(f"error getting root agent, {e}") from e
RuntimeError: error getting root agent,

@saimaheshkrishna
Copy link

Facing same issue on importing " from google.adk.models.lite_llm import LiteLlm "

@TusharVashishth
Copy link

I am also facing same issue when trying to use LiteLLM with ADK

@nneverwei
Copy link
Contributor Author

I am also facing same issue when trying to use LiteLLM with ADK

  1. downgrading Litellm to v1.66
  2. If you're using windows,The source code needs to be modified to change the relload of fastapi sever to False fix(cli): Disable auto-reload feature on Windows system #415

then everything is ok

@TusharVashishth
Copy link

Thanks @nneverwei After downgrading the version to V1.66 it's working fine in Mac .

@boyangsvl boyangsvl added the models Issues about model support label Apr 27, 2025
@boyangsvl boyangsvl marked this as a duplicate of #418 Apr 27, 2025
@MrOrz
Copy link

MrOrz commented May 2, 2025

It's a bug in litellm and not related to adk-python.

Ping litellm to 1.67.2, or upgrade to 1.67.4.post1 helps.
BerriAI/litellm#10349 (comment)

nneverwei added a commit to nneverwei/adk-docs that referenced this issue May 13, 2025
…e. So users(esp. windows) can disable this if they come across the '_make_subprocess_transport NotImplementedError' bug on windows.

[issue-#414](google/adk-python#414)
[pull-#415](google/adk-python#415)
@krrishdholakia
Copy link

Acknowledging the issue - we're working on this

@krrishdholakia
Copy link

krrishdholakia commented May 13, 2025

this looks like it's been fixed since v1.67.4

File "D:\tools\anaconda3\envs\test_adk_313\Lib\site-packages\litellm\responses\litellm_completion_transformation\transformation.py", line 9, in
from enterprise.enterprise_hooks.session_handler import (
...<2 lines>...
)

This line no longer exists in our codebase. It's now in a try-except.

Commit: BerriAI/litellm@1e0ee22#diff-ab79fe7e44da7e4b6266450180d908ea8d7dd6599bec809ef25d2bb5f31d4077

Image

@selcukgun selcukgun added this to the FixIt Week milestone May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
models Issues about model support
Projects
None yet
Development

No branches or pull requests

7 participants