Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
MIT License
166.45k stars 44.06k forks source link

Auto-gpt executes python code successfully but does not generate .png file #4571

Closed jordanshirley96 closed 12 months ago

jordanshirley96 commented 1 year ago

⚠️ Search for existing issues first ⚠️

Which Operating System are you using?

Linux/Ubuntu

Which version of Auto-GPT are you using?

Stable (branch)

Do you use OpenAI GPT-3 or GPT-4?

GPT-3.5

Which area covers your issue best?

Commands

Describe your issue.

I've instructed autogpt to execute the file pizza.py. The code generates an image of a pizza as a .png file in the auto_gpt_workspace directory.

Autogpt can create and execute the code without error, and additionally it prints a message at the end of the file, indicating it worked it's way through the code. However, this code specifically generates a .png image which is nowhere to be found after it runs the code. When I manually run the code with python3 pizza.py, it successfully generates the image of the pizza in the auto_gpt_workspace folder. I think this issue has something to do with the docker container, as I am using docker-compose, but I am unsure.

Anybody know how to resolve this issue?

Upload Activity Log Content

No response

Upload Error Log Content

No response

Boostrix commented 1 year ago

have you tried explicitly setting the current working directory to the workspace ? Keep in mind that due to security considerations, python will be executed in a sandboxed environment - only executing python via shell command will circumvent this measure

lc0rp commented 1 year ago

Further suggestions to help debug the issue:

Dr33dM3 commented 1 year ago

Based on the provided information, it seems that the issue you're facing is likely due to running Auto-GPT outside a containerized environment, such as Docker. The documentation clearly states that executing Python scripts is disabled in non-container environments to maintain system and data security. https://docs.agpt.co/ home page gives us this info

To address this problem, you have a couple of options:

Modify the pizza.py code so that it generates the image without relying on executing Python scripts or writing files in the auto_gpt_workspace folder.

Run Auto-GPT within a containerized environment, like Docker, where the necessary permissions are granted to write files in the specified folder.
Boostrix commented 1 year ago

If that's the case, the OP could also directly execute python via the shell

jordanshirley96 commented 1 year ago

Yes I am running inside a Docker container. When I run my script directly with a /bin/bash inside the docker container it outputs the .png file. The issue is when autogpt itself runs the script.

On Wed, Jun 7, 2023, 9:37 p.m. Dr33dM3 @.***> wrote:

Based on the provided information, it seems that the issue you're facing is likely due to running Auto-GPT outside a containerized environment, such as Docker. The documentation clearly states that executing Python scripts is disabled in non-container environments to maintain system and data security.

To address this problem, you have a couple of options:

Modify the pizza.py code so that it generates the image without relying on executing Python scripts or writing files in the auto_gpt_workspace folder.

Run Auto-GPT within a containerized environment, like Docker, where the necessary permissions are granted to write files in the specified folder.

— Reply to this email directly, view it on GitHub https://github.com/Significant-Gravitas/Auto-GPT/issues/4571#issuecomment-1581840151, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6FJJJW3FQD6PTWOPKJOIQDXKFCIHANCNFSM6AAAAAAYZX7DXA . You are receiving this because you authored the thread.Message ID: @.***>

Boostrix commented 1 year ago

Adapt the script to output hostname + cwd during startup to see what's going on

github-actions[bot] commented 1 year ago

This issue has automatically been marked as stale because it has not had any activity in the last 50 days. You can unstale it by commenting or removing the label. Otherwise, this issue will be closed in 10 days.

github-actions[bot] commented 12 months ago

This issue was closed automatically because it has been stale for 10 days with no activity.