-
Notifications
You must be signed in to change notification settings - Fork 5k
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
ImportError: cannot import name 'AssistantAgent' from 'autogen' #705
Comments
This can happen if there is a file named autogen.py in your current folder. Can you confirm that you do not have any files or folders named autogen in the directory where you are working? |
Same thing Bro: teachable_agent = atg.TeachableAgent( user = atg.UserProxyAgent("user", human_input_mode="ALWAYS") GIVES >>> Traceback (most recent call last): |
Maybe a python version issue? |
Uninstalling and reinstalling worked for me. I noticed I did not have to specifically mention [teachable] to have it installed. |
Looks like this is resolved. |
Maybe you have installed |
I used 'pip install autogen' by mistake,uninstalling autogen and autopep8 worked for me |
Was running into the same problem. Maybe highlight this in the installation documentation. |
I believe I approved a documentation PR yesterday that adds this to the FAQ. Hopefully merged soon (if not already) |
I uninstalled autogen and autopep8, and upgraded pyautogen, and the error became: ImportError: cannot import name 'UserProxyAgent' from 'autogen' (unknown location) |
copied the basic autogen script from this video by @tylerprogramming and am getting this error: AttributeError: module 'autogen' has no attribute 'config_list_from_json' |
Hey @teachable-david, I can try to help you! Thanks for watching the video, but I guess the first thing (if you haven't already) is to try to I see you tried above from reading more comments, but since it can't find the library from what it seems, try the below two ways it may work: If you have already tried that, I don't know exactly why this has worked for me, but remove the import, and then re-type it. Sometimes it then was able to find the library for use. Also try a brand new project and Let me know and I can try to help more |
Thanks for the reply @tylerprogramming! I followed the pip installation suggestions. I also installed Visual Studio since I'd been working in VS Code and I learned that doesn't allow project creation. I've started a new project in Visual Studio and copied the code into it from your video. I also followed the instructions in the terminal to add a folder location to my path/environment variables. But when I run the autogen script, I still see the error, "no module named autogen." In this thread it's also suggested that pyautogen is the issue, but I have upgraded it and uninstalled autogen. I have had success with AutoGen in the past without using a Python environment, so I don't expect that to be the issue. However, since I'm currently stumped, I will probably create a venv and start the project again in it. I'll try anything else that you think might help. Thanks again! |
|
Before creating a new environment, please clean cache for both conda and pip. |
Tried this in notebook:
It still results in: ImportError: cannot import name 'ConversableAgent' from 'autogen' (unknown location) |
By doing all the above, I am able to import other agents like UserProxyAgent, but not TeachableAgent. What could be the issue? |
@gops-sukumar Hey, so just checking and I don't see the TeachableAgent as part of the autogen code. That's why it cannot import it. It's been a while since I've used it, but it seems they either removed it completely. I think they re-vamped it. Looking through, they have a 'teachability' in the contributions section. What this does, is create a teachable agent in the class, but REALLY it's just a 'conversableagent'. They modify how it behaves.
Example:
|
$ python test/twoagent.py
Traceback (most recent call last):
File "D:\workspace\luan\autogen\test\twoagent.py", line 1, in
from autogen import AssistantAgent, UserProxyAgent, config_list_from_json
ImportError: cannot import name 'AssistantAgent' from 'autogen' (C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\autogen_init_.py)
Yesterday it worked fine, but today it runs and shows this error.
The text was updated successfully, but these errors were encountered: