microsoft / autogen

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

[Bug]: No such file or directory: 'python' when trying to use LocalCommandLineCodeExecutor along with user_proxy_agent for code execution #3315

Open SamhithKakarla opened 1 month ago

SamhithKakarla commented 1 month ago

Describe the bug

I was following the "two-agent coding example" on this doc: https://microsoft.github.io/autogen/docs/topics/non-openai-models/cloud-togetherai/

I copy pasted the code word for word and tried to run it but i got the following error:

NO HUMAN INPUT RECEIVED.

USING AUTO REPLY...

EXECUTING CODE BLOCK (inferred language is python)... Traceback (most recent call last): File "/Users/samhith/EhrAgent2/ehragent/autogen_together.py", line 51, in chat_result = user_proxy_agent.initiate_chat( File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 1019, in initiate_chat self.send(msg2send, recipient, silent=silent) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 656, in send recipient.receive(message, self, request_reply, silent) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 821, in receive self.send(reply, sender, silent=silent) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 656, in send recipient.receive(message, self, request_reply, silent) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 819, in receive reply = self.generate_reply(messages=self.chat_messages[sender], sender=sender) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 1973, in generate_reply final, reply = reply_func(self, messages=messages, sender=sender, config=reply_func_tuple["config"]) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/agentchat/conversable_agent.py", line 1471, in _generate_code_execution_reply_using_executor code_result = self._code_executor.execute_code_blocks(code_blocks) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/coding/local_commandline_code_executor.py", line 246, in execute_code_blocks return self._execute_code_dont_check_setup(code_blocks) File "/Users/samhith/Library/Python/3.9/lib/python/site-packages/autogen/coding/local_commandline_code_executor.py", line 305, in _execute_code_dont_check_setup result = subprocess.run( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run with Popen(*popenargs, **kwargs) as process: File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'python'

i have the latest version of pyautogen and together ai

Steps to reproduce

Try running the "Two-Agent Coding Example" from this doc: https://microsoft.github.io/autogen/docs/topics/non-openai-models/cloud-togetherai/

Model Used

mistralai/Mixtral-8x7B-Instruct-v0.1

Expected Behavior

The code should have executed

Screenshots and logs

No response

Additional Information

No response

WaelKarkoub commented 1 month ago

Does it print the code block it tried to execute by any chance?

SamhithKakarla commented 1 month ago

Yes, Here is a picture of the full output, after which it throws the exception mentioned above:

Screenshot 2024-08-07 at 10 16 02 PM

i can also find the .py file with the code it wants to execute in the "coding" directory as in the tutorial i linked. It just seems to be unable to run it