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

from autogen import AssistantAgent, UserProxyAgent Gives Circular Import error #30

Closed
walker-null-byte opened this issue Sep 27, 2023 · 31 comments

Comments

@walker-null-byte
Copy link

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

@gagb
Copy link
Collaborator

gagb commented Sep 28, 2023

@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.

Screen.Recording.2023-09-27.at.5.37.33.PM.mov

@walker-null-byte
Copy link
Author

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

@gagb
Copy link
Collaborator

gagb commented Sep 28, 2023

@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.

Screen.Recording.2023-09-27.at.6.23.36.PM.mov

@walker-null-byte
Copy link
Author

OK yeaa i named it autogen.py... i feel really dumb rn lol. Thanks for the help!

@walker-null-byte
Copy link
Author

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?

@gagb
Copy link
Collaborator

gagb commented Sep 28, 2023

@walker-null-byte , Seems like an issue with setup. Are you able to reproduce your error in a fresh directory and install of AutoGen?

@walker-null-byte
Copy link
Author

sorry for the late reply. Yes i am getting the same error

@DoriShabat
Copy link

Same error here:
ImportError: cannot import name 'AssistantAgent' from 'autogen'

@sonichi
Copy link
Collaborator

sonichi commented Oct 2, 2023

Is pip install pyautogen used to install the package?

@gagb
Copy link
Collaborator

gagb commented Oct 2, 2023

Yeah its possible you did pip install autogen instead of pip install pyautogen

@walker-null-byte
Copy link
Author

redoing pip install pyautogen fixes it for me, thanks!

@CarlHodges
Copy link

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

@akhilnchauhan
Copy link

I'm having the same issue, uninstalled and re-installed. Tried in multiple venv too

@CUexter
Copy link

CUexter commented Oct 9, 2023

Same

Edit: Sorry, I named my file autogen.py which is dumb

@goforit5
Copy link

redoing pip install pyautogen fixes it for me too! Thanks

@Alnevis
Copy link

Alnevis commented Oct 19, 2023

OK yeaa i named it autogen.py... i feel really dumb rn lol. Thanks for the help!

me too

@JTedam
Copy link

JTedam commented Oct 20, 2023

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

@erdogancayir
Copy link

may be you can use Virtual Environment

python3 -m venv autogen
source autogen/bin/activate
pip install pyautogen

@erdogancayir
Copy link

erdogancayir commented Oct 20, 2023

You don't use both import autoagen and from autogen import AssistantAgenton the same page.
Your file name must not autoagen.py.

@rolme
Copy link

rolme commented Oct 23, 2023

installing pyautogen instead of autogen did the trick for me. thanks!

@zenetio
Copy link

zenetio commented Nov 11, 2023

What worked for me after facing the error:

  • removed pyautogen
  • reinstalled pyautogen
  • in the notebook:
    • import autogen
    • from autogen import AssistantAgent, UserProxyAgent, config_list_from_json

@ShimiShimson
Copy link

@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.

Screen.Recording.2023-09-27.at.6.23.36.PM.mov

I also named my file autogen.py. No wonder it complains about circular import. Thank you very much!

@MattiaBaldinetti
Copy link

MattiaBaldinetti commented Nov 20, 2023

I have an error like this: AttributeError: module 'autogen' has no attribute 'AssistantAgent'

pyautogen 0.1.14
autogen 1.0.16
openai 1.3.3

@ganesh1603
Copy link

I have an error like this: AttributeError: module 'autogen' has no attribute 'AssistantAgent'

pyautogen 0.1.14 autogen 1.0.16 openai 1.3.3

Uninstalll pyautogen autogen
then upgrade your pip by following command: python.exe -m pip install --upgrade pip
then install autogen again by following command : pip install pyautogen

@sonichi
Copy link
Collaborator

sonichi commented Nov 20, 2023

I have an error like this: AttributeError: module 'autogen' has no attribute 'AssistantAgent'

pyautogen 0.1.14 autogen 1.0.16 openai 1.3.3

uninstall autogen

@kennydd001
Copy link

the errors you guys are facing is because you did pip install autogen.
just do pip uninstall autogen.
pip install pyautogen

@kennydd001
Copy link

I have an error like this: AttributeError: module 'autogen' has no attribute 'AssistantAgent'

pyautogen 0.1.14 autogen 1.0.16 openai 1.3.3

pip uninstall autogen. you only need pyautogen

@oldmanjk
Copy link

oldmanjk commented Apr 4, 2024

@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.

Screen.Recording.2023-09-27.at.6.23.36.PM.mov

This should be added to the doc

@ekzhu
Copy link
Collaborator

ekzhu commented Apr 4, 2024

@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.
Screen.Recording.2023-09-27.at.6.23.36.PM.mov

This should be added to the doc

Do you want to add a one line to FAQ? https://microsoft.github.io/autogen/docs/FAQ#install-the-correct-package---pyautogen

@Andy-Chase
Copy link

I had a similar issue becuase I pip installed "autogen" not "pyautogen" haha. I feel quite dumb!

@oldmanjk
Copy link

@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.
Screen.Recording.2023-09-27.at.6.23.36.PM.mov

This should be added to the doc

Do you want to add a one line to FAQ? https://microsoft.github.io/autogen/docs/FAQ#install-the-correct-package---pyautogen

Sorry, I'm just now seeing this message. I don't really remember what this issue is about and I've never done a pull request. Maybe someone familiar with the process would like to do it. Or, if microsoft is hiring, I could certainly learn how =;-)

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

No branches or pull requests