AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Unable to run built docker container: No module named autogpt

Open psvensson opened this issue 1 year ago • 3 comments

Duplicates

  • [X] I have searched the existing issues

Steps to reproduce 🕹

Docker buidl goes perfectly fine, albeit with a lot of warning..

docker run -it --env-file=./.env -v ~/auto_gpt_workspace:/app/auto_gpt_workspace autogpt

gives back:

/usr/local/bin/python: No module named autogpt

I have followed the README exactly. This is a checked out master from some minutes ago.

Current behavior 😯

/usr/local/bin/python: No module named autogpt

Expected behavior 🤔

It should just run, right?

Your prompt 📝

# Paste your prompt here

psvensson avatar Apr 15 '23 08:04 psvensson

The fix is on the way with #1425

Qoyyuum avatar Apr 15 '23 09:04 Qoyyuum

Fixed

edit: oops possibly duplicate by #1425

alessandropalla avatar Apr 15 '23 09:04 alessandropalla

I just encountered this today after trying to run with Docker (latest).

M00NSH0T avatar May 02 '23 17:05 M00NSH0T

I reverted from 0.3 to 0.2.2 and it works. Didn't really dig in much past that, but might be worth somebody checking that the fix didn't get reverted in this new release...

M00NSH0T avatar May 02 '23 18:05 M00NSH0T

I'm not able to reproduce your error with 0.3.0 on Linux. Are you using macOS?

image

samuelbutler avatar May 02 '23 18:05 samuelbutler

I'm on Windows

M00NSH0T avatar May 02 '23 18:05 M00NSH0T

I'm getting the same error on Windows running on Docker latest version:

"/usr/local/bin/python: No module named autogpt"

badcom avatar May 02 '23 18:05 badcom

@badcom @M00NSH0T what exact command are you trying to use to start it? (the one in the original ticket is not using windows pathes)

ppetermann avatar May 02 '23 18:05 ppetermann

happens when I run docker-compose run --rm auto-gpt in the directory with the .env and docker-compose.yml files.

M00NSH0T avatar May 02 '23 18:05 M00NSH0T

@M00NSH0T is that the root directory of auto-gpt 0.3.0, or do you have those files in a different directory?

ppetermann avatar May 02 '23 19:05 ppetermann

no I put those files in a different directory. Just followed what's here: https://docs.agpt.co/setup/#set-up-with-docker

M00NSH0T avatar May 02 '23 19:05 M00NSH0T

I also have the same issue on windows.

compose file image

image

hackern0v1c3 avatar May 02 '23 19:05 hackern0v1c3

same here

bartoszc avatar May 02 '23 19:05 bartoszc

guys, that docker-compose.yml mounts the local directory into the container, if you are in another directory, obviously the autogpt subfolder won't be mounted in. so either you adjust the docker-compose.yml to not mount . to /app OR you run it from a folder that actually has the source.

ppetermann avatar May 02 '23 19:05 ppetermann

ok so I was able to get it to work when my xml (edit: yaml... sorry for the typo) file was this:

version: "3.9"
services:
  auto-gpt:
    image: significantgravitas/auto-gpt:0.2.2
    depends_on:
      - redis
    env_file:
      - .env
    environment:
      MEMORY_BACKEND: ${MEMORY_BACKEND:-redis}
      REDIS_HOST: ${REDIS_HOST:-redis}
    volumes:
      - ./:/app
    profiles: ["exclude-from-up"]
  redis:
    image: "redis/redis-stack-server:latest"

I had to set to the 0.2.2 version, which I also pulled prior to this. When I followed the instructions per the link from earlier, which pulls 0.3 and kept the reference to the latest image in the yaml file, I got that error.

M00NSH0T avatar May 02 '23 19:05 M00NSH0T

this is yaml, not xml

mounting . into /app doesn't do much with 0.2.2 as 0.2.2 used a different path, hence your local directory is not overwriting whats in the container, hence it will run - not by design though

ppetermann avatar May 02 '23 19:05 ppetermann

guys, that docker-compose.yml mounts the local directory into the container, if you are in another directory, obviously the autogpt subfolder won't be mounted in. so either you adjust the docker-compose.yml to not mount . to /app OR you run it from a folder that actually has the source.

If I modify my docker compose to not mount . to /app I receive a new error. However with the mount 0.2.2 works like @M00NSH0T has also experienced.

new docker compose image

new error image

hackern0v1c3 avatar May 02 '23 19:05 hackern0v1c3

this is yaml, not xml

mounting . into /app doesn't do much with 0.2.2 as 0.2.2 used a different path, hence your local directory is not overwriting whats in the container, hence it will run - not by design though

Maybe this requires a documentation fix. I am following the guide here https://docs.agpt.co/setup/#run-with-docker

It explicitly says to create a docker-compose file with the mount. But based on your explanation it should not. image

However the container still fails with a ModuleNotFoundError when I am not mounting the volume.

hackern0v1c3 avatar May 02 '23 19:05 hackern0v1c3

@hackern0v1c3 as i said thats because 0.2.2 was using other pathes.

the scripts error is related to the production build not including scripts because it assumes you have the folder mounted

ppetermann avatar May 02 '23 19:05 ppetermann

yes, i can confirm that the documentation has issues.

ppetermann avatar May 02 '23 19:05 ppetermann

Okay thanks for looking and the quick responses.
What do you suggest that we do to run in docker with 0.3 on windows? I'm not sure what you mean by "the scripts error is related to the production build not including scripts because it assumes you have the folder mounted" or how I should go about resolving that issue. Is there a valid docker-compose that we could reference?

hackern0v1c3 avatar May 02 '23 19:05 hackern0v1c3

@hackern0v1c3 the issue is actually not really windows related, i guess we *nix folk are more on the end of using the source ;)

as for what you can do, the pragmatic way is: download the release, copy your config into the extracted folder, and run it from there - not ideal, but pragmatic.

you can also build the image from the source yourself, but make sure you are building the dev variant, as that includes everything vs. only the autogpt folder

ppetermann avatar May 02 '23 19:05 ppetermann

https://github.com/ppetermann/Auto-GPT-DockerSetup this is the setup I'm running, which is a bit more complex, but it works, however there might be some pre-existing docker-knowledge required

ppetermann avatar May 02 '23 19:05 ppetermann

thanks. I'll try that.

M00NSH0T avatar May 02 '23 19:05 M00NSH0T

Again I appreciate your help. I'll take a look at these resources. My feedback would just be that the "Setup with docker" documentation here https://docs.agpt.co/setup/#set-up-with-docker is a bit misleading. It works for v0.2.2 but not 0.3. Most likely due to the fact that 0.2.2 was using other paths as you mentioned. It would be great if the documentation were updated, or at least a warning added that they will only work for 0.2.2 without additional undocumented steps.

hackern0v1c3 avatar May 02 '23 19:05 hackern0v1c3

I second that... I had it all running fine yesterday in a dedicated conda environment I setup. Just downloaded the repo and it worked great. Unfortunately this morning, I updated Docker Desktop which I'd been putting off for a while, and ever since AutoGPT just keeps trying to install modules (like requests, beautifulsoup, etc.) over and over without it affecting whatever Docker container it's using to run python scripts. I figured I'd go back and reinstall using Docker hoping that would solve the infinite loop issue with it not actually being able to install dependencies.

But that led me here... yeah an update to the documentation would definitely be nice. I appreciate you sending that link to your docker setup in the meantime @ppetermann . Thank you

M00NSH0T avatar May 02 '23 19:05 M00NSH0T

I'm working on an update, just not something that appears of thin air ;)

ppetermann avatar May 02 '23 20:05 ppetermann

It looks like someone has a pull request in to fix this already #3706 I can build an image locally and run .0.3.0 by adding the additional two lines from that pull request to the dockerfile. That should get me by until it's merged and the dockerhub image is updated.

Didn't mean to offend with the documentation comment. I know you guys have your hands full. Just trying to provide constructive feedback.

hackern0v1c3 avatar May 02 '23 20:05 hackern0v1c3

guys, that docker-compose.yml mounts the local directory into the container, if you are in another directory, obviously the autogpt subfolder won't be mounted in. so either you adjust the docker-compose.yml to not mount . to /app OR you run it from a folder that actually has the source.

Thanks for catching that, we should probably remove the volume mount from that template docker-compose.yml

Pwuts avatar May 02 '23 20:05 Pwuts

@hackern0v1c3 does your solution require following the git setup, modifying the Docker file, then building the docker image?

alex-s-gardner avatar May 02 '23 22:05 alex-s-gardner