Skip to content
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

ModuleNotFoundError: No module named 'grpc' #4382

Open
gagb opened this issue Nov 26, 2024 · 1 comment
Open

ModuleNotFoundError: No module named 'grpc' #4382

gagb opened this issue Nov 26, 2024 · 1 comment

Comments

@gagb
Copy link
Collaborator

gagb commented Nov 26, 2024

What happened?

I ran the weather agents from https://microsoft.github.io/autogen/dev/user-guide/agentchat-user-guide/quickstart.html

What did you expect to happen?

I expected the code to run instead I got

  File "/Users/gaganbansal/workspace/test-autogen/weather.py", line 5, in <module>
    from autogen_agentchat.teams import RoundRobinGroupChat
  File "/Users/gaganbansal/miniconda3/envs/test-autogen/lib/python3.10/site-packages/autogen_agentchat/teams/__init__.py", line 1, in <module>
    from ._group_chat._base_group_chat import BaseGroupChat
  File "/Users/gaganbansal/miniconda3/envs/test-autogen/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_base_group_chat.py", line 7, in <module>
    from autogen_core.application import SingleThreadedAgentRuntime
  File "/Users/gaganbansal/miniconda3/envs/test-autogen/lib/python3.10/site-packages/autogen_core/application/__init__.py", line 6, in <module>
    from ._worker_runtime import WorkerAgentRuntime
  File "/Users/gaganbansal/miniconda3/envs/test-autogen/lib/python3.10/site-packages/autogen_core/application/_worker_runtime.py", line 53, in <module>
    from .protos import agent_worker_pb2, agent_worker_pb2_grpc
  File "/Users/gaganbansal/miniconda3/envs/test-autogen/lib/python3.10/site-packages/autogen_core/application/protos/agent_worker_pb2_grpc.py", line 3, in <module>
    import grpc
ModuleNotFoundError: No module named 'grpc'

How can we reproduce it (as minimally and precisely as possible)?

conda create -n test-autogen python==3.10
conda activate test-autogen
pip install 'autogen-agentchat==0.4.0.dev7' 'autogen-ext[openai]==0.4.0.dev7'
python weather.py

Here weather.py contains:

import asyncio

from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.task import Console, TextMentionTermination
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_ext.models import OpenAIChatCompletionClient


# Define a tool
async def get_weather(city: str) -> str:
    return f"The weather in {city} is 73 degrees and Sunny."


async def main() -> None:
    # Define an agent
    weather_agent = AssistantAgent(
        name="weather_agent",
        model_client=OpenAIChatCompletionClient(
            model="gpt-4o-2024-08-06",
            # api_key="YOUR_API_KEY",
        ),
        tools=[get_weather],
    )

    # Define termination condition
    termination = TextMentionTermination("TERMINATE")

    # Define a team
    agent_team = RoundRobinGroupChat([weather_agent], termination_condition=termination)

    # Run the team and stream messages to the console
    stream = agent_team.run_stream(task="What is the weather in New York?")
    await Console(stream)

asyncio.run(main())

AutoGen version

autogen-agentchat==0.4.0.dev7

Which package was this bug in

Core

Model used

gpt-4o

Python version

3.10

Operating system

Mac

Any additional info you think would be helpful for fixing this bug

No response

@ekzhu
Copy link
Collaborator

ekzhu commented Nov 26, 2024

Let's add grpc related dependencies back.

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

No branches or pull requests

2 participants