AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

ModuleNotFoundError: No module named 'scripts'

Open Boostrix opened this issue 1 year ago • 25 comments

⚠️ Search for existing issues first ⚠️

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

Which Operating System are you using?

Docker

Which version of Auto-GPT are you using?

Stable (branch)

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal

Docker version 23.0.5, build bc4487a

$ docker pull significantgravitas/auto-gpt

REPOSITORY TAG IMAGE ID CREATED SIZE significantgravitas/auto-gpt latest a1e88fe207ec 3 hours ago 1.65GB redis/redis-stack-server latest 0021013ed7f6 8 days ago 329MB

Current behavior 😯

Traceback (most recent call last): File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/app/autogpt/main.py", line 5, in autogpt.cli.main() File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in call return self.main(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1635, in invoke rv = super().invoke(ctx) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/app/autogpt/cli.py", line 87, in main from autogpt.main import run_auto_gpt File "/app/autogpt/main.py", line 22, in from scripts.install_plugin_deps import install_plugin_dependencies ModuleNotFoundError: No module named 'scripts'

Expected behavior 🤔

No response

Your prompt 📝

# Paste your prompt here

Your Logs 📒

<insert your logs here>

Boostrix avatar May 02 '23 18:05 Boostrix

I am having same issue. It seems that the docker image is not made correctly as it doesn't seem to have all the files that exist in stable in /app or /app/autogpt

ForceConstant avatar May 02 '23 18:05 ForceConstant

yes, that seems about right - all the stuff is readily there inside the source tree, it just doesn't seem to be available/found in the docker img

Nothing in the Dockerfile pointing at scripts currently: https://github.com/Significant-Gravitas/Auto-GPT/blob/master/Dockerfile Not sure if there are some lower level helper scripts involved ?

EDIT: And thanks for confirming !

Boostrix avatar May 02 '23 18:05 Boostrix

Aye you are right, scripts and plugins (which ultimately scripts needs to exist because install deps doesn't check if the folder exists, just tries to install any zips it finds in the plugins folder) are only copied in the dev builds which just copy entire root into the app folder.

I added them both in #3706

prom3theu5 avatar May 02 '23 19:05 prom3theu5

Thanks for being so responsive, would you happen to know what the process is now? When can we expect the image to reflect those changes?

Boostrix avatar May 02 '23 19:05 Boostrix

No idea tbh ^^. They have a lot of open PRs

What I would do is take the source download from the 0.3.0 release here: https://github.com/Significant-Gravitas/Auto-GPT/releases/tag/v0.3.0 And add in the two lines in my PR to the dockerfile - then just do docker(/podman) build -t <desired_tag> . from within the extracted folder. That way you can patch yourself while you wait and just build the container locally

prom3theu5 avatar May 02 '23 19:05 prom3theu5

running into the same issue with :latest and :v0.3.0 tags

builder555 avatar May 02 '23 23:05 builder555

Build the image. If you have pulled the image from Docker Hub, skip this step.

docker-compose build auto-gpt

0xFlo avatar May 02 '23 23:05 0xFlo

Build the image. If you have pulled the image from Docker Hub, skip this step.

docker-compose build auto-gpt

literally followed the tutorial:

  1. docker pull significantgravitas/auto-gpt
  2. created folder auto-gpt
  3. created file docker-compose.yml as per instructions
  4. added .env file
  5. docker-compose run --rm auto-gpt

same error

builder555 avatar May 03 '23 00:05 builder555

Sorry if unhelpful, but also having same issue setting auto GPT up for the first time on a brand new Mac OS fresh install on Monterrey on an Apple Silicon chip. Followed instructions to the letter and running auto GPT for the first time yields the same issue on latest v0.3.0 release

sgarcia-dev avatar May 03 '23 01:05 sgarcia-dev

No idea tbh ^^. They have a lot of open PRs

What I would do is take the source download from the 0.3.0 release here: https://github.com/Significant-Gravitas/Auto-GPT/releases/tag/v0.3.0 And add in the two lines in my PR to the dockerfile - then just do docker(/podman) build -t <desired_tag> . from within the extracted folder. That way you can patch yourself while you wait and just build the container locally

Thank you for the follow up @prom3theu5, you're very kind. I did what you suggested and added the changes from your Open PR locally: https://github.com/Significant-Gravitas/Auto-GPT/pull/3706

And then ran docker build -t v0.3.0 . as suggested locally, but running auto-gpt still shows up the same ModuleNotFoundError: No module named 'scripts'. Guess I'll wait until an official fix is up 🙂

sgarcia-dev avatar May 03 '23 01:05 sgarcia-dev

A workaround for now (not even near to be the best approach) is to use the previous version, this will probably get fix pretty soon as it seems like a critical one (basic docker steps in the documentation are broken).

https://hub.docker.com/layers/significantgravitas/auto-gpt/0.2.2/images/sha256-77ff3a615cb97b0d064ec60174f3657d09d6e75bb5ae3b3523ef16020402a12a?context=explore

I just got it running with 0.2.2 .

It works for initial exploration and playing around with it.

Change the image line in the docker-compose.yml file to this:

image: significantgravitas/auto-gpt:0.2.2

And for pulling the image use this one instead:

docker pull significantgravitas/auto-gpt:0.2.2

jac1013 avatar May 03 '23 01:05 jac1013

No idea tbh ^^. They have a lot of open PRs What I would do is take the source download from the 0.3.0 release here: https://github.com/Significant-Gravitas/Auto-GPT/releases/tag/v0.3.0 And add in the two lines in my PR to the dockerfile - then just do docker(/podman) build -t <desired_tag> . from within the extracted folder. That way you can patch yourself while you wait and just build the container locally

Thank you for the follow up @prom3theu5, you're very kind. I did what you suggested and added the changes from your Open PR locally: #3706

And then ran docker build -t v0.3.0 . as suggested locally, but running auto-gpt still shows up the same ModuleNotFoundError: No module named 'scripts'. Guess I'll wait until an official fix is up 🙂

You’re very welcome

Aye there was a merge conflict as another pr went in that updated the docker file with the scripts folder too (which is in master and not my pr anymore as that was conflicted)

basically you need to also add

ONBUILD COPY scripts/ ./scripts Same place as you added plug-ins

it’s already merged into master that line, but that was after 0.3.0 and after my original comments here ^^, so release won’t have that

prom3theu5 avatar May 03 '23 01:05 prom3theu5

No idea tbh ^^. They have a lot of open PRs What I would do is take the source download from the 0.3.0 release here: https://github.com/Significant-Gravitas/Auto-GPT/releases/tag/v0.3.0 And add in the two lines in my PR to the dockerfile - then just do docker(/podman) build -t <desired_tag> . from within the extracted folder. That way you can patch yourself while you wait and just build the container locally

Thank you for the follow up @prom3theu5, you're very kind. I did what you suggested and added the changes from your Open PR locally: #3706 And then ran docker build -t v0.3.0 . as suggested locally, but running auto-gpt still shows up the same ModuleNotFoundError: No module named 'scripts'. Guess I'll wait until an official fix is up 🙂

You’re very welcome

Aye there was a merge conflict as another pr went in that updated the docker file with the scripts folder too (which is in master and not my pr anymore as that was conflicted)

basically you need to also add

ONBUILD COPY scripts/ ./scripts Same place as you added plug-ins

it’s already merged into master that line, but that was after 0.3.0 and after my original comments here ^^, so release won’t have that

Worked like a charm. Thank you!

jslate5 avatar May 03 '23 02:05 jslate5

same issue...

koosha-t avatar May 03 '23 02:05 koosha-t

For anyone wondering the exact steps to fix your install right now :

  1. Go into your autogpt folder
  2. Clone the V0.3.0 release sources:
git clone -b v0.3.0 https://github.com/Significant-Gravitas/Auto-GPT.git ./sources
  1. Fix the dockerfile :
cd sources
awk 'NR==39{print "ONBUILD COPY scripts/ ./scripts\nONBUILD COPY plugins/ ./plugins"}1' Dockerfile > tmp; mv tmp Dockerfile
  1. Build the container :
docker build -t autogpt-v0.3.0 .
  1. Fix your docker-compose :
cd ..
sed "s#image: significantgravitas/auto-gpt#image: autogpt-v0.3.0#" docker-compose.yml > tmp; mv tmp docker-compose.yml
  1. Enjoy auto-gpt :
docker-compose run --rm auto-gpt

Thanks @prom3theu5 for the instructions :)

bragagia avatar May 03 '23 10:05 bragagia

For anyone wondering the exact steps to fix your install right now :

  1. Go into your autogpt folder
  2. Clone the V0.3.0 release sources:
git clone -b v0.3.0 https://github.com/Significant-Gravitas/Auto-GPT.git ./sources
  1. Fix the dockerfile :
cd sources
awk 'NR==39{print "ONBUILD COPY scripts/ ./scripts\nONBUILD COPY plugins/ ./plugins"}1' Dockerfile > tmp; mv tmp Dockerfile
  1. Build the container :
docker build -t autogpt-v0.3.0 .
  1. Fix your docker-compose :
cd ..
sed "s#image: significantgravitas/auto-gpt#image: autogpt-v0.3.0#" docker-compose.yml > tmp; mv tmp docker-compose.yml
  1. Enjoy auto-gpt :
docker-compose run --rm auto-gpt

Thanks @prom3theu5 for the instructions :)

berkerAa avatar May 03 '23 10:05 berkerAa

I don't know what the process is like, but you folks should consider getting involved in the project to help with this Dockerfile stuff and to help update the docker related docs (they're way outdated). You guys have been remarkably helpful and response, thanks !

Hope someone from the inner circle sees that, and you'll get an invite !!

Boostrix avatar May 03 '23 11:05 Boostrix

Even easier than rebuilding docker image, you could just edit docker-compose.yaml and map the scripts and plugins directory. i.e. add - ./scripts:/app/scripts

ForceConstant avatar May 03 '23 12:05 ForceConstant

Looks like this is fixed in v 0.3.1 #3710

hackern0v1c3 avatar May 03 '23 13:05 hackern0v1c3

The story seems to continue (significantgravitas/auto-gpt latest bdbf2bfcb8de):

File "/app/autogpt/main.py", line 64, in run_auto_gpt motd, is_new_motd = get_latest_bulletin() File "/app/autogpt/utils.py", line 130, in get_latest_bulletin open("data/CURRENT_BULLETIN.md", "w", encoding="utf-8").write(new_bulletin) FileNotFoundError: [Errno 2] No such file or directory: 'data/CURRENT_BULLETIN.md'

Boostrix avatar May 03 '23 18:05 Boostrix

The story seems to continue (significantgravitas/auto-gpt latest bdbf2bfcb8de):

File "/app/autogpt/main.py", line 64, in run_auto_gpt motd, is_new_motd = get_latest_bulletin() File "/app/autogpt/utils.py", line 130, in get_latest_bulletin open("data/CURRENT_BULLETIN.md", "w", encoding="utf-8").write(new_bulletin) FileNotFoundError: [Errno 2] No such file or directory: 'data/CURRENT_BULLETIN.md'

Exactly the same error for me, using the docker image with the 'latest' tag

shuntera avatar May 04 '23 17:05 shuntera

I suppose, the project needs a few more Docker gurus to help review/maintain this stuff ...

Boostrix avatar May 04 '23 17:05 Boostrix

For anyone wondering the exact steps to fix your install right now :

  1. Go into your autogpt folder
  2. Clone the V0.3.0 release sources:
git clone -b v0.3.0 https://github.com/Significant-Gravitas/Auto-GPT.git ./sources
  1. Fix the dockerfile :
cd sources
awk 'NR==39{print "ONBUILD COPY scripts/ ./scripts\nONBUILD COPY plugins/ ./plugins"}1' Dockerfile > tmp; mv tmp Dockerfile
  1. Build the container :
docker build -t autogpt-v0.3.0 .
  1. Fix your docker-compose :
cd ..
sed "s#image: significantgravitas/auto-gpt#image: autogpt-v0.3.0#" docker-compose.yml > tmp; mv tmp docker-compose.yml
  1. Enjoy auto-gpt :
docker-compose run --rm auto-gpt

Thanks @prom3theu5 for the instructions :)

Took a while to build but solved my issue 👍 . Thanks!

For all you windows / powershell people out there.

5.Fix the dockerfile:

(Get-Content -Path Dockerfile | ForEach-Object {if($_.ReadCount -eq 39) { "ONBUILD COPY scripts/ ./scripts`nONBUILD COPY plugins/ ./plugins" } $_ }) | Set-Content -Path Dockerfile

7. Fix your docker-compose

(Get-Content -Path Dockerfile | ForEach-Object {if($_.ReadCount -eq 39) { "ONBUILD COPY scripts/ ./scripts`nONBUILD COPY plugins/ ./plugins" } $_ }) | Set-Content -Path Dockerfile

thsbrown avatar May 05 '23 05:05 thsbrown

PowerShell in a python repository! Blasphemy!

With that said, let me grab that fellow PowerShell user.

anonhostpi avatar May 05 '23 05:05 anonhostpi

I followed the detailed instructions above to rebuild auto-gpt, but I got the following error:

docker-compose run --rm auto-gpt [+] Running 1/0 ✔ Container autogpt-redis-1 Created 0.0s [+] Running 1/1 ✔ Container autogpt-redis-1 Started 0.4s /usr/local/bin/python: No module named autogpt.main; 'autogpt' is a package and cannot be directly executed

shuntera avatar May 05 '23 13:05 shuntera

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] avatar Sep 06 '23 21:09 github-actions[bot]

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

github-actions[bot] avatar Sep 17 '23 01:09 github-actions[bot]