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

Can not access *.py files for execution #1896

Closed
1 task done
iva-nova-e-katerina opened this issue Apr 16, 2023 · 15 comments
Closed
1 task done

Can not access *.py files for execution #1896

iva-nova-e-katerina opened this issue Apr 16, 2023 · 15 comments

Comments

@iva-nova-e-katerina
Copy link

Duplicates

  • I have searched the existing issues

Steps to reproduce 🕹

...
EXECUTE_LOCAL_COMMANDS=True
...
python3 scripts/main.py --continuous --gpt3only
y

Current behavior 😯

NEXT ACTION:  COMMAND = execute_python_file ARGUMENTS = {'file': 'evaluate_net_worth_strategies.py'}
Executing file 'evaluate_net_worth_strategies.py' in workspace 'auto_gpt_workspace'
SYSTEM:  Command execute_python_file returned: Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

But 'evaluate_net_worth_strategies.py exists! in Auto-GPT/auto_gpt_workspace ! I swear

Expected behavior 🤔

*.py file execution

Your prompt 📝

# Paste your prompt here
@Pwuts
Copy link
Member

Pwuts commented Apr 16, 2023

To me it seems that it is executing the file, which throws the Error while fetching server API version.

@nobita2041 nobita2041 mentioned this issue Apr 16, 2023
@iva-nova-e-katerina
Copy link
Author

it can't access the disk :(

NEXT ACTION:  COMMAND = execute_shell ARGUMENTS = {'command_line': 'sudo mkdir /home/user/Auto-GPT/autogpt/auto_gpt_workspace'}
SYSTEM:  Command execute_shell returned: Error: [Errno 2] No such file or directory: '/home/user/Auto-GPT/autogpt/auto_gpt_workspace'
 THOUGHTS:  The 'autogpt' directory seems to be missing. Before we can create a 'auto_gpt_workspace' under it, we will have to create 'autogpt'. Let me create all of them using the 'execute_shell' command
REASONING:  Creating the directories in the correct sequence ensures that they are created at the right location and can aid in avoiding errors from the permission system.
PLAN: 
-  Create the directory 'autogpt' using 'sudo mkdir /home/user/Auto-GPT/autogpt'.\\n- Create the directory 'auto_gpt_workspace' using the command 'sudo mkdir /home/user/Auto-GPT/autogpt/auto_gpt_workspace'
CRITICISM:  I must exercise caution while using the 'sudo' command to mitigate any potential risks and ensure the proper functioning and security of the system.
SPEAK:  Let me create the necessary directories using 'sudo mkdir' commands arranged in the correct sequence.
Attempting to fix JSON by finding outermost brackets 
Apparently json was fixed. 
NEXT ACTION:  COMMAND = execute_shell ARGUMENTS = {'command_line': 'sudo mkdir /home/user/Auto-GPT/autogpt && sudo mkdir /home/user/Auto-GPT/autogpt/auto_gpt_workspace'}
SYSTEM:  Command execute_shell returned: Error: [Errno 2] No such file or directory: '/home/user/Auto-GPT/autogpt/auto_gpt_workspace'

To me it seems that it is executing the file, which throws the Error while fetching server API version.

@Pwuts
Copy link
Member

Pwuts commented Apr 16, 2023

That is an unrelated issue, duplicate of #1862.

@Pwuts
Copy link
Member

Pwuts commented Apr 16, 2023

It should be at least partially fixed now. Can you pull and try again?

@iva-nova-e-katerina
Copy link
Author

iva-nova-e-katerina commented Apr 17, 2023

It should be at least partially fixed now. Can you pull and try again?

git pull

Bug is still here


NEXT ACTION:  COMMAND = execute_python_file ARGUMENTS = {'file': 'evaluate_recommendations.py'}
Executing file 'evaluate_recommendations.py' in workspace '/home/user/Auto-GPT/auto_gpt_workspace'
SYSTEM:  Command execute_python_file returned: Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

@adrianlzt
Copy link

Looks like the execution differs if you are running autogpt inside of a docker container.

That error Error while fetching server API version looks like is being returned by python trying to talk with the docker daemon (do you have docker running and accessible to your user?).

A, maybe risky, workaround is to create the file /.dockerenv, used by autogpt to check if it is running inside of docker.

If that's true, it will just try to execute the python script, without using docker.

@Stunspot
Copy link

The issue is that someone rewrote the execute_python_file command to assume it was in a docker container. An app expecting to be in a docker container that isn't throws a file not found error. Was going nuts from this. Just now had ChatGPT rip out the docker crap for me. Here's my execute_code.py file:
execute_code - execute_python_file fixed.py.txt

@Jude-a11y
Copy link

The issue is that someone rewrote the execute_python_file command to assume it was in a docker container. An app expecting to be in a docker container that isn't throws a file not found error. Was going nuts from this. Just now had ChatGPT rip out the docker crap for me. Here's my execute_code.py file:
execute_code - execute_python_file fixed.py.txt

It seems right, but after I changed the execute_code.py file as your did and ran the command, the return of the SYSTEM was nothing, while it should return the output of the Python program.

@Stunspot
Copy link

I'm sorry to hear that. I just now ran it through some code analysis tools and they all say it's good. First thing I did after replacing it was have the bot write and execute a hello world. Then I had it generate and execute a "moderately complicated python file". It's happily pythoning away as we speak,.

@johnbrisbin
Copy link

The issue is that someone rewrote the execute_python_file command to assume it was in a docker container. An app expecting to be in a docker container that isn't throws a file not found error. Was going nuts from this. Just now had ChatGPT rip out the docker crap for me. Here's my execute_code.py file: execute_code - execute_python_file fixed.py.txt
Works for me. Thanks.

@Stunspot
Copy link

Glad my little ChatGPT toolset can help people.

@Pwuts
Copy link
Member

Pwuts commented Apr 18, 2023

Superseded by #2006

@Pwuts Pwuts closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2023
@iva-nova-e-katerina
Copy link
Author

bug is still here

NEXT ACTION:  COMMAND = execute_python_file ARGUMENTS = {'file': './calculate_net_worth.py'}
Executing file './calculate_net_worth.py' in workspace '/home/user/Auto-GPT/auto_gpt_workspace'
SYSTEM:  Command execute_python_file returned: Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
NEXT ACTION:  COMMAND = execute_python_file ARGUMENTS = {'file': 'calculate_net_worth.py'}
Executing file 'calculate_net_worth.py' in workspace '/home/user/Auto-GPT/auto_gpt_workspace'
SYSTEM:  Command execute_python_file returned: Error: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

@Pwuts
Copy link
Member

Pwuts commented Apr 19, 2023

@iva-nova-e-katerina please continue in #2006 if you still have issues with the latest version of master

@milkamantas
Copy link

milkamantas commented May 9, 2023

Error still persists, but I am running docker-less version

Screenshot 2023-05-09 at 16 05 50

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

7 participants