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

Could not run the script in a container. #2640

Closed
1 task done
cheungcn opened this issue Apr 20, 2023 · 33 comments
Closed
1 task done

Could not run the script in a container. #2640

cheungcn opened this issue Apr 20, 2023 · 33 comments

Comments

@cheungcn
Copy link

⚠️ Search for existing issues first ⚠️

  • I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Windows

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

I just tried using autogpt to write me a python script which prints "Hello"
I ran the autogpt in python and it does write me a script in the folder "auto_gpt_workspace"

However, when autogpt tried to verify the script by running it.
It pops out the error
"Could not run the script in a container. If you haven't already, please install Docker https://docs.docker.com/get-docker/"
And then it starts looping again and again.

Is there anything I should set? I have already installed docker. Is using gpt3.5 a problem for this?

Current behavior 😯

REASONING: The 'search_files' command returned the 'hello.py' file, indicating that the file was saved correctly. I can now execute the file using the 'execute_python_file' command.
PLAN:

  • Use the 'execute_python_file' command to execute the 'hello.py' file
    CRITICISM: I need to ensure that the file is executed correctly and that there are no syntax errors in the script.
    NEXT ACTION: COMMAND = execute_python_file ARGUMENTS = {'file': 'hello.py'}
    Executing file 'hello.py' in workspace 'F:\Prgramming\AI\AutoGPT\Auto-GPT\auto_gpt_workspace'
    Could not run the script in a container. If you haven't already, please install Docker https://docs.docker.com/get-docker/
    SYSTEM: Command execute_python_file returned: Error: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.')
    You can read more here: https://github.com/Significant-Gravitas/Auto-GPT#openai-api-keys-configuration

Expected behavior 🤔

I expect it runs just fine

Your prompt 📝

ai_goals:

  • write a python script which prints "Hello."
    ai_name: Maven
    ai_role: python writing AI

Your Logs 📒

activity.log

@Qoyyuum
Copy link
Contributor

Qoyyuum commented Apr 20, 2023

@cheungcn it is designed to execute python file inside a Docker container. This helps makes sure that it doesn't perform any malicious activities on the host machine. For now, please install Docker and try again

@cheungcn
Copy link
Author

@cheungcn it is designed to execute python file inside a Docker container. This helps makes sure that it doesn't perform any malicious activities on the host machine. For now, please install Docker and try again

Should I run the autogpt within the docker? or just install it

@Qoyyuum
Copy link
Contributor

Qoyyuum commented Apr 20, 2023 via email

@broose42
Copy link

Did you manage to find a fix for this? I have docker desktop installed and i still can't get this working

@k-boikov
Copy link
Contributor

Is docker desktop running fine? Sometimes you need to edit BIOS settings / enable hyper-v.

@Pwuts Pwuts added the docker label Apr 20, 2023
@hatgit
Copy link

hatgit commented Apr 21, 2023

I am getting same error. Wouldn't you need to create a dockerfile, I don't think it is enough to just have docker installed, but must create an actual VM with it in some directory, such as in auto_gpt_workspaceright?

@TTP21576
Copy link

Is there an alternative if Docker does not work on our Desktop? The installation is hilariously messed up.

@davetuner
Copy link

davetuner commented May 3, 2023

I'm having the same issue on macOS with Docker installed and working as expected.

@lakam99
Copy link

lakam99 commented May 4, 2023

+1

@sabr-p
Copy link

sabr-p commented May 7, 2023

+1
my setup: ubuntu VM with docker installed. means, the ubuntu is already a VM (run in VMware player), not the base box, and docker is installed inside ubuntu. auto-gpt is running in conda.

@sabr-p
Copy link

sabr-p commented May 7, 2023

ok, brief update: on ubuntu dockers needs sudo. forgot i always make my user super-duper-auto-sudoer, just do it and don't ask questions. so, the auto-gpt process maybe cannot/is not aware that needs sudo perms? and on windows could be an admin perms issue?

@Boostrix
Copy link
Contributor

Boostrix commented May 7, 2023

that is probably something that should be added to the README.md file and/or at least shown during startup if the system is ubuntu based ?

@p6002
Copy link

p6002 commented May 7, 2023

any way to fix it? i have docker installed.
Could not run the script in a container. If you haven't already, please install Docker

@Boostrix
Copy link
Contributor

Boostrix commented May 7, 2023

post your version etc - can you run docker yourself (permissions) ?

@p6002
Copy link

p6002 commented May 7, 2023

I have a clean installation of ubuntu server 22, installed everything according to the site:
https://bytexd.com/getting-started-with-auto-gpt-for-beginners-setup-usage/
I also have docker installed, working.
I run autogpt like this:

workon autogpt
cd /home/vm/Auto-GPT
python -m autogpt

Everything works except the chrome browser (I think "google" works) and python script execution due to "no docker"
In the .env file I just added the OpenAI API and the Pinecode API - both things seem to work.

https://i.ibb.co/Pxd2pqd/Capture.png
https://i.ibb.co/Ltc5rmj/k.png

@jordanshirley96
Copy link

I'm in a similar scenario, I have autogpt installed with ubuntu on a virtual box VM, yet it still demands I use docker even within the virtual environment in order to execute python scripts. Anyone know how to avoid this in this case?

@sabr-p
Copy link

sabr-p commented May 9, 2023

i think the culprit is: https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/commands/execute_code.py#L16

it just always uses a docker to run code. no option for a direct OS/bash call. what happens if the agent is already running in a container? or if i build a box just for auto-gpt and care not about the security, and actually want the agent to run and modify stuff in the (sand)box where it lives?

imo, these security options should be expected closer to v1.0.... for now let's run fast and break stuff... ;)

@Boostrix
Copy link
Contributor

Boostrix commented May 9, 2023

Also see: #3884

the analysis is correct, but it would only be ~5-10 lines of code to make this behavior optional and allow people to opt out using an env variable - the basic idea can be seen here: #4016

For a working implementation, refer to: #3713

imo, these security options should be expected closer to v1.0.... for now let's run fast and break stuff... ;)

just run: $ sudo python -m autogpt :-)

@p6002
Copy link

p6002 commented May 9, 2023

I already lost which version of autogpt is correct. I set up a clean system again yesterday, in docker installed version v0.3.0 using docker compose. Same errors. --speak does not work and disables autogp on startup. Python scripts that autogpt creates do not work. after several operations autogpt stops working completely. Has it ever worked for anyone?

@Boostrix
Copy link
Contributor

Boostrix commented May 9, 2023

try it then without the TTS for starters and then take it from there.

(yes, working mostly fine here)

@p6002
Copy link

p6002 commented May 9, 2023

try it then without the TTS for starters and then take it from there.

(yes, working mostly fine here)

Without speak, of course it "works". I can enter instructions and start the bot's work. However, after a few operations, the bot starts creating .py files that it can't use and throws it to the console. Maybe something is missing in the system? I checked the documentation and there is no such information.

It doesn't matter if auto-gpt is installed in docker or directly on the system with pip.

@Boostrix
Copy link
Contributor

Boostrix commented May 9, 2023

if you cannot execute python scripts, you are not using docker. That's explicitly mentioned in the docs, and also in the error message.

You can always enable execution of shell commands and then use that method to run your python stuff

@p6002
Copy link

p6002 commented May 9, 2023

Thanks, I'll have to start my own issue later.

@S18-izawa-shun
Copy link

I also struggled with this issue, but I may have found a clue to the solution. Either of the following steps allowed me to write and reflect the data.

(1) : Execute "docker run -it docker.io/ceramicwhite/auto-gpt" with PowerShell running as an administrator to start "localhost:3000".
(2) : In Chrome, there is an "Install" icon in the address bar. Clicking on it will make the Chrome tab disappear and a pop-up for "AutoGPT Terminal" will appear.

I believe step (2) might be the cause, but I'm not entirely sure.

@p6002
Copy link

p6002 commented May 15, 2023

The project is functional, but it has numerous errors that prevent any meaningful use of the tool. However, the concept itself is fine.

@EricMinick
Copy link

Even if Docker is installed, if it isn't running, AutoGPT doesn't figure that out. Run a "docker stats" to validate that the daemon is up.

@ericjee
Copy link

ericjee commented May 17, 2023

Have you ever contemplated that numerous users, akin to myself, might attempt to use auto-GPT in a remote IDE environment where Docker installation is fundamentally unfeasible?

@chromial
Copy link

chromial commented Jun 6, 2023

sabr-p wrote... if i build a box just for auto-gpt and care not about the security, and actually want the agent to run and modify stuff in the (sand)box where it lives?

Amen! This is exactly my situation. I built a box specifically for auto-gpt; I don't run it on my daily driver.
If it performs any malicious activities I'll wipe the box and reinstall the OS.

as Boostrix suggested, I should be allowed to opt out of using docker via an env variable.
my box, my choice.

@Boostrix
Copy link
Contributor

Boostrix commented Jun 6, 2023

it would not be difficult to edit the command system accordingly, I would still suggest you use a dedicated autogpt user account to ensure that it cannot tinker with your your main user account, let alone with being root/admin.

the docker related security measures involving python execution are rather self-contained and obvious if you open the file, so can be disabled easily, I would still suggest to only do do so if the current $USER is named "autogpt"

@haxwell
Copy link

haxwell commented Jul 13, 2023

I got over this error by adding my current user to the docker group, rebooting (signing out probably would have sufficed), and trying it again. Annoying error resolved! I think other people said effectively the same thing: its a permissions issue.

sudo usermod -aG docker $USER

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

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 github-actions bot added the Stale label Sep 6, 2023
@github-actions
Copy link
Contributor

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 17, 2023
@skyefleming
Copy link

This is not an issue with Docker being installed, when you allow AutoGPT to run commands on the system it doesn't know it's not "in" python so in Linux you will issue a directive to the AutoGPT instance to call scripts in the workspace with 'bash -c'

I reported this as a bug to improve the message behavior, people here talking about running the module with sudo or installing docker. This particular issue was on Windows, the AutoGPT instance probably just needed to call the script "correctly" for a Windows/Python shell instance?

#7658

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

No branches or pull requests