microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
34.85k stars 5.05k forks source link

Issue with running Magentic One on Windows 11 #4134

Closed Kumala3 closed 1 week ago

Kumala3 commented 2 weeks ago

What happened?

Hi, I've been trying to run Magentic One on Windows 11 following the instructions specified in the README.md here and once I did all the steps I faced the following issue:

Traceback (most recent call last):
  File "E:\my_computer_path\autogen\python\packages\autogen-magentic-one\examples\example.py", line 8, in <module>
    from autogen_core.application import SingleThreadedAgentRuntime
ModuleNotFoundError: No module named 'autogen_core'

I've used PowerShell terminal from VS Code, ensured the Docker Desktop is running, imported environmental variables and checked that autogen_core module is installed using this command: pip list | findstr autogen_core

Image

What did you expect to happen?

I expect to run Magentic One successfully to test this out.

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

  1. Clone the repo: git clone https://github.com/microsoft/autogen.git
  2. Navigate to the dir: cd autogen/python/packages/autogen-magentic-one
  3. Create a new Python virtual environment: python -m venv venv
  4. Activate the virtual environment: venv/Scripts/activate
  5. Install the necessary dependencies: pip install -e .
  6. Install Chromium using playwright to be able to interact with the browser: playwright install --with-deps chromium
  7. Run python examples/example.py --logs_dir ./my_logs

AutoGen version

0.2.38

Which package was this bug in

Magentic One

Model used

gpt-4o

Python version

3.12.0

Operating system

Windows 11

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

No response

avelops commented 2 weeks ago

Hey @Kumala3 I'm getting the same error on windows 11 vscode using the same steps you mentioned,

I solved it by doing the following:

Clone the repo: git clone https://github.com/microsoft/autogen.git Navigate to the dir: cd autogen/python/ Run: uv sync --all-extras Activate the venv create by uv: . .venv\Scripts\activate.ps1 (i used full path, ex. c:\code\autogen\python\.venv\Scripts\activate.ps1 Create the Enviroment Variables, for ex.: $env:CHAT_COMPLETION_KWARGS_JSON = value according to this https://github.com/microsoft/autogen/tree/main/python/packages/autogen-magentic-one#environment-configuration-for-chat-completion-client Install the necessary dependencies from auto-magentic-one folder: cd packages/autogen-magentic-one && pip install -e . Install Chromium using playwright to be able to interact with the browser: playwright install --with-deps chromium Run: python examples/example.py --logs_dir ./my_logs --hil_mode

Got some error on ffmpeg missing but all in all it went fine. Can you try this as well?

note: to make the '&&' work you need powershell 7 iirc.

Kumala3 commented 1 week ago

Hey @avelops

I was able to run it now! Thanks so much! The key was in the 3rd command: uv sync --all-extras. I initially tried to create my own virtual environment, and it didn't work. I also wondered why there's this command but now I understand that this is a package manager, and it basically creates a .venv directory with necessary packages. It works smoothly now, so excited to test this out. I really like the architecture of this framework, the specialized team where the boss: "Orchestrator" tracks the progress to make sure it's on the right track and wasn't hooked in a loop makes it efficient in terms of saving the number of requests made to an API you use.

avelops commented 1 week ago

That's great @Kumala3 !