reworkd / AgentGPT

🤖 Assemble, configure, and deploy autonomous AI Agents in your browser.
https://agentgpt.reworkd.ai
GNU General Public License v3.0
30.6k stars 9.17k forks source link

Windows setup.bat producing error #834

Open Aphexus opened 1 year ago

Aphexus commented 1 year ago

Please check that this issue hasn't been reported before.

Expected Behavior

Should work

Current behaviour

Not working

Steps to reproduce

Follow all steps

Possible solution

? How will you be running AgentGPT? 🐋 Docker-compose (Recommended)

Env files successfully created! node:events:489 throw er; // Unhandled 'error' event ^

Error: spawn docker-compose ENOENT at ChildProcess._handle.onexit (node:internal/child_process:285:19) at onErrorNT (node:internal/child_process:483:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:291:12) at onErrorNT (node:internal/child_process:483:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn docker-compose', path: 'docker-compose', spawnargs: [ 'up', '--build' ]

I can run docker-compose at the cl and it runs. I've installed the latest nodejs, docker, and agentgpt on a relatively fresh system

Note that I do get

setup.bat npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'agentgpt-cli@1.0.0', npm WARN EBADENGINE required: { node: '>=18.0.0 <19.0.0' }, npm WARN EBADENGINE current: { node: 'v20.3.0', npm: '9.6.7' } npm WARN EBADENGINE }

Which Operating Systems are you using?

Acknowledgements

asim-shrestha commented 1 year ago

Not quite sure given I don't have access to a windows machine at the moment. Given it works via the command line, once you create your env you no longer need to use the setup scripts so you can just run via docker compose in the command line directly.

It could just be that this windows script hasn't yet worked, if you're up to trying to fix it happy to take in a PR.

Attached is a ChatGPT response

Node Version Compatibility: As the warning message indicates, the agentgpt-cli package is not compatible with the installed version of Node.js (v20.3.0). The version of Node.js required should be '>=18.0.0 <19.0.0'. Try downgrading Node.js to a version within this range.

Verify Docker Installation: Make sure Docker is properly installed and functioning as expected. You can verify this by running a simple Docker command, like docker run hello-world. If this works, Docker should be properly installed.

Ensure Docker-Compose Availability: Ensure that the docker-compose command is available from your command line. You can check this by running docker-compose --version in the command line.

Path Variable: If Docker Compose is installed but the error persists, ensure that Docker's installation path is included in your system's PATH environment variable.

Run as Administrator: Sometimes, permissions issues can cause these kinds of problems. Try running the command as an administrator, or using sudo if you're on a Unix-like system.

Clean Reinstall: If all else fails, you might consider uninstalling Node.js, Docker, and AgentGPT, and then reinstalling them in the following order: Docker, Node.js (with the correct version), and then AgentGPT.
enosh94 commented 1 year ago

With Ubuntu Linux, I experienced the same problem. In my system, "docker compose" was installed rather than "docker-compose" . The workaround I used to make it functional is detailed below.

$ sudo touch /bin/docker-compose $ sudo echo 'docker compose --compatibility "$@"' > /bin/docker-compose $ sudo chmod +x /bin/docker-compose

Aphexus commented 1 year ago

So after screwing around with it and not really having any success I eventually got it to work by having docker create the image from the cloned git directory and I could bring up the local page. When I try to run an agent I get errors though for every task: "An unknown error occurred. Please try again later.". I added the OAI key and no luck except it does say it passed the test(not sure if it called OAI or not to test though).

I'm assuming something isn't setup through this docker process that needs to be or that it can't get outside the network to access anything? I did not sign in to docker to do all that though, do I have to and why?

asim-shrestha commented 1 year ago

This is docker-compose right? Is the platform container running (That is the backend). Do you have access to the backend logs to see whats going on? Alternatively, you can look at the front end request and see what the issue is

RGBok commented 1 year ago

With Ubuntu Linux, I experienced the same problem. In my system, "docker compose" was installed rather than "docker-compose" . The workaround I used to make it functional is detailed below.

$ sudo touch /bin/docker-compose $ sudo echo 'docker compose --compatibility "$@"' > /bin/docker-compose $ sudo chmod +x /bin/docker-compose

that one command will end with denied permissions on my system so if it does for you too, try

$ sudo sh -c 'echo "docker compose --compatibility \"\$@\"" > /bin/docker-compose'

Aphexus commented 1 year ago

This is docker-compose right? Is the platform container running (That is the backend). Do you have access to the backend logs to see whats going on? Alternatively, you can look at the front end request and see what the issue is

I'm using windows. I cloned agentgpt and ran setup.bat and followed the instructions and this is the error I get:

? How will you be running AgentGPT? 🐋 Docker-compose (Recommended) node:events:489 throw er; // Unhandled 'error' event ^

Error: spawn docker-compose ENOENT at ChildProcess._handle.onexit (node:internal/child_process:285:19) at onErrorNT (node:internal/child_process:483:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:291:12) at onErrorNT (node:internal/child_process:483:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn docker-compose', path: 'docker-compose', spawnargs: [ 'up', '--build' ]

I have node.js and docker desktop installed and running. The best I can tell is spawn docker compose is failing for some reason. I'm looking at index.js right now to see if it is a configuration problem.

If I use docker desktop to build an image from agentGPT's dir I can get it to work except no tasks complete and I get an unknown error. From that I don't know what logs to view or where to look for them to figure it out(I'm new to docker).

That is, using docker desktop to "build" the image I can get all the way up to the point of agentGPT working except for the very last point and it seems like it is something to do with a connection issue.

I guess the info I need to get further is this:

  1. Can I build the docker image using docker and expect it to work without much trouble or do I have to use setup.bat to get it to run?

  2. Assuming 1, what would be the likely cause of the error when the agents should be retrieving web pages and where could I find such logs to figure out what it might be(likely connection issues but maybe database or something else?).

  3. npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'agent-gpt@0.8.0', npm WARN EBADENGINE required: { node: '>=18.0.0 <19.0.0' }, npm WARN EBADENGINE current: { node: 'v20.3.0', npm: '9.7.1' }

Could this have anything to do with version issues?

Everything is done on my computer so I should have access to all the logs and such, I just don't know where to look... I'm going to put in some effort to figure it out today though as at least I made a bit more progress. I'm, right now, trying to run everything manually.

Using the manual run I'm having issues with the database. I installed mysql

  1. the database info in the env files are all configured for non-standard mysql install. Port is 3307 rather than 3307, database name is db rather than the name of the computer, etc.

prisma:error Invalid p.user.findUnique() invocation in L:\AI\Projects\AgentGPT\next\node_modules\@next-auth\prisma-adapter\dist\index.js:210:43

207 return { 208 createUser: (data) => p.user.create({ data }), 209 getUser: (id) => p.user.findUnique({ where: { id } }), → 210 getUserByEmail: (email) => p.user.findUnique( Can't reach database server at db:3306

Please make sure your database server is running at db:3306.

I updated the env files to use my comp's name rather than db and configured mysql to use port 3307.

Strange though "docker run -p "3306:3306" -e "MYSQL_PASSWORD=reworkd_platform" -e "MYSQL_USER=reworkd_platform" -e "MYSQL_DATABASE=reworkd_platform" -e ALLOW_EMPTY_PASSWORD=yes bitnami/mysql:8.0.30"

uses port 3306 so I don't know why it is hard coded on 3307 in the env files.

  1. Invalid p.user.findUnique() invocation in L:\AI\Projects\AgentGPT\next\node_modules\@next-auth\prisma-adapter\dist\index.js:210:43

    207 return { 208 createUser: (data) => p.user.create({ data }), 209 getUser: (id) => p.user.findUnique({ where: { id } }), → 210 getUserByEmail: (email) => p.user.findUnique( User reworkd_platform was denied access on the database reworkd_platform wait - compiling / (client and server)... event - compiled client and server successfully in 382 ms (1439 modules)

Added that and get table error. So anyways, it seems that the setup process did not setup the database or the directions are inadaquate. Surely there is an sql script or code to set it up somewhere?

am I not running some setup step?

The two processes I'm running are

next\npm run dev

platform\poetry run python -m reworkd_platform

I was following these steps:

if (runOption === "manual") { console.log( "Please go into the ./next folder and run npm install && npm run dev." ); console.log( "Please also go into the ./platform folder and run poetry install && poetry run python -m reworkd_platform." ); console.log( "Please use or update the MySQL database configuration in the env file(s)." ); } };

and seems I'm stuck on the database. Seems it's more than just changing the env variables but also setting it up(I would think the code itself would create the database, tables, etc but that doesn't seem to be the case).

Any ideas? I could did through the code and try to reconstruct the tables and all that but something is off so I'll wait...

Aphexus commented 1 year ago

prisma:query SELECT reworkd_platform.User.id, reworkd_platform.User.name, reworkd_platform.User.email, reworkd_platform.User.emailVerified, reworkd_platform.User.image, reworkd_platform.User.createDate FROM reworkd_platform.User WHERE (reworkd_platform.User.email = ? AND 1=1) LIMIT ? OFFSET ? prisma:error Invalid p.user.findUnique() invocation in L:\AI\Projects\AgentGPT\next\node_modules\@next-auth\prisma-adapter\dist\index.js:210:43

207 return { 208 createUser: (data) => p.user.create({ data }), 209 getUser: (id) => p.user.findUnique({ where: { id } }), → 210 getUserByEmail: (email) => p.user.findUnique( The table user does not exist in the current database.

I have done everything "by the book" and this is the error I am getting. It seems to be an issue with the database not being configured in manual model properly under windows.

There is a schema.prisma file that has the database layout in it but I have no idea how to use it to get it to setup the database.

Here is a windows batch file that does a fresh install of AgentGPT. Running it gets to the above error. I did insall mysql and create the database manually so.

@ECHO OFF L: cd \ cd L:\AI\Projects\ set AGPTDIR=L:\AI\Projects\AgentGPT

echo ----------------Removing AgentGPT---------------- rd /S /Q %AGPTDIR%

echo ----------------Cloning AgentGPT---------------- cd L:\AI\Projects\ git clone https://github.com/reworkd/AgentGPT

echo ----------------Executing AgentGPT Setup (Select Manual)---------------- cd %AGPTDIR% call setup.bat

echo ----------------Update Env Files---------------- fnr.exe --cl --dir "%AGPTDIR%\next" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_DATABASE_HOST=db" --replace "REWORKD_PLATFORM_DATABASE_HOST=localhost" fnr.exe --cl --dir "%AGPTDIR%\next" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "DATABASE_HOST=db" --replace "DATABASE_HOST=localhost" fnr.exe --cl --dir "%AGPTDIR%\platform" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_DATABASE_HOST=db" --replace "REWORKD_PLATFORM_DATABASE_HOST=localhost" fnr.exe --cl --dir "%AGPTDIR%\platform" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "DATABASE_HOST=db" --replace "DATABASE_HOST=localhost"

fnr.exe --cl --dir "%AGPTDIR%\next" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_OPENAI_API_KEY=""""" --replace "REWORKD_PLATFORM_OPENAI_API_KEY=""BLAH""" fnr.exe --cl --dir "%AGPTDIR%\platform" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_OPENAI_API_KEY=""""" --replace "REWORKD_PLATFORM_OPENAI_API_KEY=""BLAH"""

fnr.exe --cl --dir "%AGPTDIR%\next" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_SERP_API_KEY=""""" --replace "REWORKD_PLATFORM_SERP_API_KEY=""BLAH""" fnr.exe --cl --dir "%AGPTDIR%\platform" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_SERP_API_KEY=""""" --replace "REWORKD_PLATFORM_SERP_API_KEY=""BLAH"""

fnr.exe --cl --dir "%AGPTDIR%\next" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_SERP_API_KEY=""""" --replace "REWORKD_PLATFORM_SERP_API_KEY=""BLAH""" fnr.exe --cl --dir "%AGPTDIR%\platform" --fileMask ".env" --excludeFileMask ".dll, .exe" --find "REWORKD_PLATFORM_REPLICATE_API_KEY=""""" --replace "REWORKD_PLATFORM_REPLICATE_API_KEY=""BLAH"""

echo ----------------Installing npm---------------- cd %AGPTDIR%\next\ start /D "%AGPTDIR%\next" /WAIT npm install

echo ----------------Installing poetry---------------- cd %AGPTDIR%\platform\ start /D "%AGPTDIR%\platform" /WAIT poetry install

echo Spawning Poetry Reworkd start /D "%AGPTDIR%\platform" poetry run python -m reworkd_platform

echo running agentGPT cd %AGPTDIR%\next\ npm run dev

Aphexus commented 1 year ago

Ensure DB is available before running Prisma commands

./wait-for-db.sh db 3307

Run Prisma commands

if [[ ! -f "/app/prisma/${DATABASE_URL:5}" ]]; then npx prisma migrate deploy --name init npx prisma db push fi

Generate Prisma client

npx prisma generate

npx prisma db push

initalized the db

Not sure why half the code is hard coded to use port 3307 and the other have 3306.

Anyways, now I'm getting errors like

2023-06-30 16:59:18.727 | ERROR | logging:callHandlers:1706 - Exception in ASGI application

and these come around

<ClientResponse(https://google.serper.dev/search?q=basic+concepts+and+principles+of+hyperbolic+geometry) [403 Forbidden]>

aiohttp.client_exceptions.ClientResponseError: 403, message='Forbidden', url=URL('https://google.serper.dev/search?q=basic+concepts+and+principles+of+hyperbolic+geometry') 2023-06-30 17:00:59.276 | INFO | logging:callHandlers:1706 - 127.0.0.1:51818 - "GET /api/agent/tools HTTP/1.1" 200 <ClientResponse(https://google.serper.dev/search?q=basic+concepts+and+principles+of+hyperbolic+geometry) [403 Forbidden]>

Sheesh, nothing but problems. I'm assuming this has to do with serper since

"Unauthorized. Sign up for a free account."

Which I already did and supplied the key in the setup. If I sign in and add api_key to the search I get unauthorized. Not sure what is going on at this point ;/

jasangill1 commented 12 months ago

Hello @Aphexus what is your setup environment ?

jasangill1 commented 11 months ago

Hello @Aphexus Are you still experiencing these issues ??

Aphexus commented 11 months ago

Hello @Aphexus Are you still experiencing these issues ??

Yes but I haven't messed with it since.

As I said, I got it to work up to what seems to be serper not working(maybe it was a temporary issue too).

It mainly seems to be a configuration issue with the database in the manual setup mode but I haven't touched it since.

jasangill1 commented 11 months ago

@Aphexus
We added a serper key verification on start up to help troubleshoot the error!! Please give it a try when you get a chance !!!