from autogen import AssistantAgent, UserProxyAgent Gives Circular Import error
from autogen import AssistantAgent, UserProxyAgent ImportError: cannot import name 'AssistantAgent' from partially initialized module 'autogen' (most likely due to a circular import)
The above is the error message
@walker-null-byte, thank you for the issue. But I am not able to reproduce your error. See video below. Can you please provide your full code (including filenames), commands you ran to install autogen, platform, python version, etc.
https://github.com/microsoft/autogen/assets/13227607/60b40f9a-fe14-4f47-82b7-9799dc32006b
only the import part is enough to give me the error
For installing i used - pip install autogen[blendsearch] --break-system-packages
then when i got the circular import error, i used - pip install autogen --break-system-packages
I am using python 3.11.5
I am using Garuda Linux with kernel - 6.5.3-zen1-1-zen
NOTE: --break-system-packages is used to override the warnings of pacman, and in most cases it has no effect on python. Circular Import in my experience is not caused by the --break-system-packages tag, but i might be wrong.
Thank You
@walker-null-byte, thank you, will try to reproduce! One more question:
how do you run this python statement?
from autogen import AssistantAgent, UserProxyAgent
Python notebook? Python interpreter in command line? Or you have a script on your disk? Note that running this statement in a file called autogen.py can result in a circular import error (see video below). So please double-check.
https://github.com/microsoft/autogen/assets/13227607/520c100d-f79b-4cfe-9b56-75288af10146
OK yeaa i named it autogen.py... i feel really dumb rn lol. Thanks for the help!
from autogen import AssistantAgent, UserProxyAgent, Completion, tune_data, eval_func, test_instance ImportError: cannot import name 'AssistantAgent' from 'autogen'
Ok i got this new issue now. Any idea if im doing anything dumb again?
@walker-null-byte , Seems like an issue with setup. Are you able to reproduce your error in a fresh directory and install of AutoGen?
sorry for the late reply. Yes i am getting the same error
Same error here:
ImportError: cannot import name 'AssistantAgent' from 'autogen'
Is pip install pyautogen used to install the package?
Yeah its possible you did pip install autogen instead of pip install pyautogen
redoing pip install pyautogen fixes it for me, thanks!
Im getting this issue. I have removed all, tested in new area. new environment. I have done the pip install autogen, ive have removed and done the pip install pyautogen. Still getting this error:
ImportError: cannot import name 'AssistantAgent' from 'autogen' from line 1 of my main.py file
I'm having the same issue, uninstalled and re-installed. Tried in multiple venv too
Same
Edit: Sorry, I named my file autogen.py which is dumb
redoing pip install pyautogen fixes it for me too! Thanks
OK yeaa i named it autogen.py... i feel really dumb rn lol. Thanks for the help!
me too
had a similar error and had to uninstalled pyautogen and reinstalled pyautogen but first, I upgraded my version of Pip before I reinstalled pyautogen and it works fine now. [notice] A new release of pip available: 22.3.1 -> 23.3 [notice] To update, run: python.exe -m pip install --upgrade pip cmd: python.exe -m pip install --upgrade pip
may be you can use Virtual Environment
python3 -m venv autogen
source autogen/bin/activate
pip install pyautogen
You don't use both import autoagen and from autogen import AssistantAgenton the same page.
Your file name must not autoagen.py.
installing pyautogen instead of autogen did the trick for me. thanks!