Sinaptik-AI / pandas-ai

Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
https://pandas-ai.com
Other
13.56k stars 1.32k forks source link

Docker Compose Build issue #1408

Open hamxahbhatti opened 4 weeks ago

hamxahbhatti commented 4 weeks ago

System Info

Hey I am trying to run the platform locally and using the intructions which were given in this thread. https://docs.pandas-ai.com/platform

when i am building the docker using the docker compose commmand i am getting error and service stop running.

pandabi-backend | ERROR: Application startup failed. Exiting.

Platform Details:

Linux "Ubuntu 22.04.4 LTS" Docker version 27.3.1

πŸ› Describe the bug

Build Logs

Creating network "pandas-ai_pandabi-network" with driver "bridge" Creating pandas-ai_postgresql_1 ... done Creating pandabi-frontend ... done Creating pandabi-backend ... done Attaching to pandabi-frontend, pandas-ai_postgresql_1, pandabi-backend pandabi-backend | startup.sh: line 6: log: command not found postgresql_1 | postgresql_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization postgresql_1 | postgresql_1 | 2024-10-24 09:58:10.417 UTC [1] LOG: starting PostgreSQL 14.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20211027) 10.3.1 20211027, 64-bit postgresql_1 | 2024-10-24 09:58:10.417 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgresql_1 | 2024-10-24 09:58:10.417 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgresql_1 | 2024-10-24 09:58:10.422 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgresql_1 | 2024-10-24 09:58:10.428 UTC [21] LOG: database system was shut down at 2024-10-24 06:37:08 UTC postgresql_1 | 2024-10-24 09:58:10.433 UTC [1] LOG: database system is ready to accept connections pandabi-frontend | pandabi-frontend | > client@0.1.0 start pandabi-frontend | > next start pandabi-frontend | pandabi-frontend | ⚠ You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env pandabi-frontend | β–² Next.js 14.2.3 pandabi-frontend | - Local: http://localhost:3000 pandabi-frontend | pandabi-frontend | βœ“ Starting... pandabi-frontend | βœ“ Ready in 747ms pandabi-backend | Resolving dependencies... pandabi-backend | Warning: The locked version 3.9.1 for matplotlib is a yanked version. Reason for being yanked: The Windows wheels, under some conditions, caused segfaults in unrelated user code. Due to this we deleted the Windows wheels to prevent these segfaults, however this caused greater disruption as pip then began to try (and fail) to build 3.9.1 from the sdist on Windows which impacted far more users. Yanking the whole release is the only tool available to eliminate these failures without changes to on the user side. The sdist, OSX wheel, and manylinux wheels are all functional and there are no critical bugs in the release. Downstream packagers should not yank their builds of Matplotlib 3.9.1. See https://github.com/matplotlib/matplotlib/issues/28551 for details. pandabi-backend | poetry install pandabi-backend | Installing dependencies from lock file pandabi-backend | pandabi-backend | No dependencies to install or update pandabi-backend | pandabi-backend | Installing the current project: pandasai-server (0.1.0) pandabi-backend | pandabi-backend | Warning: The current project could not be installed: No file/folder found for package pandasai-server pandabi-backend | If you do not want to install the current project use --no-root. pandabi-backend | If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. pandabi-backend | In a future version of Poetry this warning will become an error! pandabi-backend | wait-for-it.sh: 4: shift: can't shift that many pandabi-backend | export DEBUG='1' pandabi-backend | export ENVIRONMENT='development' pandabi-backend | export GPG_KEY='A035C8C19219BA821ECEA86B64E628F8D684696D' pandabi-backend | export HOME='/root' pandabi-backend | export HOSTNAME='99c683c72737' pandabi-backend | export LANG='C.UTF-8' pandabi-backend | export MAKEFLAGS='' pandabi-backend | export MAKELEVEL='1' pandabi-backend | export MFLAGS='' pandabi-backend | export PANDASAI_API_KEY='$2a$10$eLN.4Ut5vlqZi9V6OIQBkOAyMA42AxgV9lwgwkxnT5bCoWBSzFt/q' pandabi-backend | export PATH='/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/bin:/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' pandabi-backend | export POSTGRES_URL='postgresql+asyncpg://pandasai:password123@postgresql:5432/pandasai-db' pandabi-backend | export PS1='(pandasai-server-py3.11) ' pandabi-backend | export PWD='/app' pandabi-backend | export PYTHON_SHA256='07a4356e912900e61a15cb0949a06c4a05012e213ecd6b4e84d0f67aabbee372' pandabi-backend | export PYTHON_VERSION='3.11.10' pandabi-backend | export SHLVL='1' pandabi-backend | export SHOW_SQL_ALCHEMY_QUERIES='0' pandabi-backend | export TEST_POSTGRES_URL='postgresql+asyncpg://pandasai:password123@postgresql:5432/pandasai-db' pandabi-backend | export VIRTUAL_ENV='/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11' pandabi-backend | export VIRTUAL_ENVPROMPT='pandasai-server-py3.11' pandabi-backend | export ='/usr/bin/make' pandabi-backend | poetry run alembic upgrade head pandabi-backend | Traceback (most recent call last): pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/bin/alembic", line 8, in pandabi-backend | sys.exit(main()) pandabi-backend | ^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/config.py", line 636, in main pandabi-backend | CommandLine(prog=prog).main(argv=argv) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/config.py", line 626, in main pandabi-backend | self.run_cmd(cfg, options) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/config.py", line 603, in run_cmd pandabi-backend | fn( pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/command.py", line 406, in upgrade pandabi-backend | script.run_env() pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/script/base.py", line 582, in run_env pandabi-backend | util.load_python_file(self.dir, "env.py") pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file pandabi-backend | module = load_module_py(module_id, path) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py pandabi-backend | spec.loader.exec_module(module) # type: ignore pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "", line 940, in exec_module pandabi-backend | File "", line 241, in _call_with_frames_removed pandabi-backend | File "/app/migrations/env.py", line 10, in pandabi-backend | from app.models import Base pandabi-backend | ModuleNotFoundError: No module named 'app' pandabi-backend | make: * [Makefile:52: migrate] Error 1 pandabi-backend | export DEBUG='1' pandabi-backend | export ENVIRONMENT='development' pandabi-backend | export GPG_KEY='A035C8C19219BA821ECEA86B64E628F8D684696D' pandabi-backend | export HOME='/root' pandabi-backend | export HOSTNAME='99c683c72737' pandabi-backend | export LANG='C.UTF-8' pandabi-backend | export MAKEFLAGS='' pandabi-backend | export MAKELEVEL='1' pandabi-backend | export MFLAGS='' pandabi-backend | export PANDASAI_API_KEY='$2a$10$eLN.4Ut5vlqZi9V6OIQBkOAyMA42AxgV9lwgwkxnT5bCoWBSzFt/q' pandabi-backend | export PATH='/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/bin:/root/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' pandabi-backend | export POSTGRES_URL='postgresql+asyncpg://pandasai:password123@postgresql:5432/pandasai-db' pandabi-backend | export PS1='(pandasai-server-py3.11) ' pandabi-backend | export PWD='/app' pandabi-backend | export PYTHON_SHA256='07a4356e912900e61a15cb0949a06c4a05012e213ecd6b4e84d0f67aabbee372' pandabi-backend | export PYTHON_VERSION='3.11.10' pandabi-backend | export SHLVL='1' pandabi-backend | export SHOW_SQL_ALCHEMY_QUERIES='0' pandabi-backend | export TEST_POSTGRES_URL='postgresql+asyncpg://pandasai:password123@postgresql:5432/pandasai-db' pandabi-backend | export VIRTUAL_ENV='/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11' pandabi-backend | export VIRTUAL_ENVPROMPT='pandasai-server-py3.11' pandabi-backend | export ='/usr/bin/make' pandabi-backend | poetry run python main.py pandabi-backend | INFO: Will watch for changes in these directories: ['/app'] pandabi-backend | INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) pandabi-backend | INFO: Started reloader process [58] using StatReload pandabi-backend | INFO: Started server process [62] pandabi-backend | INFO: Waiting for application startup. pandabi-backend | 2024-10-24 09:58:31,386 INFO sqlalchemy.engine.Engine select pg_catalog.version() pandabi-backend | 2024-10-24 09:58:31,386 INFO sqlalchemy.engine.Engine [raw sql] () pandabi-backend | 2024-10-24 09:58:31,388 INFO sqlalchemy.engine.Engine select current_schema() pandabi-backend | 2024-10-24 09:58:31,388 INFO sqlalchemy.engine.Engine [raw sql] () pandabi-backend | 2024-10-24 09:58:31,389 INFO sqlalchemy.engine.Engine show standard_conforming_strings pandabi-backend | 2024-10-24 09:58:31,389 INFO sqlalchemy.engine.Engine [raw sql] () pandabi-backend | 2024-10-24 09:58:31,391 INFO sqlalchemy.engine.Engine BEGIN (implicit) pandabi-backend | 2024-10-24 09:58:31,400 INFO sqlalchemy.engine.Engine SELECT anon_1.id, anon_1.email, anon_1.first_name, anon_1.created_at, anon_1.password, anon_1.verified, anon_1.last_name, anon_1.features, organization_1.id AS id_1, organization_1.name, organization_1.url, organization_1.is_default, organization_1.settings, organization_membership_1.id AS id_2, organization_membership_1.user_id, organization_membership_1.organization_id, organization_membership_1.role, organization_membership_1.verified AS verified_1 pandabi-backend | FROM (SELECT "user".id AS id, "user".email AS email, "user".first_name AS first_name, "user".created_at AS created_at, "user".password AS password, "user".verified AS verified, "user".last_name AS last_name, "user".features AS features pandabi-backend | FROM "user" pandabi-backend | LIMIT $1::INTEGER OFFSET $2::INTEGER) AS anon_1 LEFT OUTER JOIN organization_membership AS organization_membership_1 ON anon_1.id = organization_membership_1.user_id LEFT OUTER JOIN organization AS organization_1 ON organization_1.id = organization_membership_1.organization_id pandabi-backend | 2024-10-24 09:58:31,400 INFO sqlalchemy.engine.Engine [generated in 0.00031s] (1, 0) postgresql_1 | 2024-10-24 09:58:31.401 UTC [28] ERROR: relation "user" does not exist at character 700 postgresql_1 | 2024-10-24 09:58:31.401 UTC [28] STATEMENT: SELECT anon_1.id, anon_1.email, anon_1.first_name, anon_1.created_at, anon_1.password, anon_1.verified, anon_1.last_name, anon_1.features, organization_1.id AS id_1, organization_1.name, organization_1.url, organization_1.is_default, organization_1.settings, organization_membership_1.id AS id_2, organization_membership_1.user_id, organization_membership_1.organization_id, organization_membership_1.role, organization_membership_1.verified AS verified_1 postgresql_1 | FROM (SELECT "user".id AS id, "user".email AS email, "user".first_name AS first_name, "user".created_at AS created_at, "user".password AS password, "user".verified AS verified, "user".last_name AS last_name, "user".features AS features postgresql_1 | FROM "user" postgresql_1 | LIMIT $1::INTEGER OFFSET $2::INTEGER) AS anon_1 LEFT OUTER JOIN organization_membership AS organization_membership_1 ON anon_1.id = organization_membership_1.user_id LEFT OUTER JOIN organization AS organization_1 ON organization_1.id = organization_membership_1.organization_id pandabi-backend | 2024-10-24 09:58:31,402 INFO sqlalchemy.engine.Engine ROLLBACK pandabi-backend | ERROR: Traceback (most recent call last): pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 514, in _prepare_and_execute pandabi-backend | prepared_stmt, attributes = await adapt_connection._prepare( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 760, in _prepare pandabi-backend | prepared_stmt = await self._connection.prepare( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/asyncpg/connection.py", line 636, in prepare pandabi-backend | return await self._prepare( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/asyncpg/connection.py", line 654, in _prepare pandabi-backend | stmt = await self._get_statement( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/asyncpg/connection.py", line 433, in _get_statement pandabi-backend | statement = await self._protocol.prepare( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "asyncpg/protocol/protocol.pyx", line 166, in prepare pandabi-backend | asyncpg.exceptions.UndefinedTableError: relation "user" does not exist pandabi-backend | pandabi-backend | The above exception was the direct cause of the following exception: pandabi-backend | pandabi-backend | Traceback (most recent call last): pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context pandabi-backend | self.dialect.do_execute( pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute pandabi-backend | cursor.execute(statement, parameters) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 572, in execute pandabi-backend | self._adaptconnection.await( pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only pandabi-backend | return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn pandabi-backend | value = await result pandabi-backend | ^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 550, in _prepare_and_execute pandabi-backend | self._handle_exception(error) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 501, in _handle_exception pandabi-backend | self._adapt_connection._handle_exception(error) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 784, in _handle_exception pandabi-backend | raise translated_error from error pandabi-backend | sqlalchemy.dialects.postgresql.asyncpg.AsyncAdapt_asyncpg_dbapi.ProgrammingError: <class 'asyncpg.exceptions.UndefinedTableError'>: relation "user" does not exist pandabi-backend | pandabi-backend | The above exception was the direct cause of the following exception: pandabi-backend | pandabi-backend | Traceback (most recent call last): pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 671, in lifespan pandabi-backend | async with self.lifespan_context(app): pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 566, in aenter pandabi-backend | await self._router.startup() pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 648, in startup pandabi-backend | await handler() pandabi-backend | File "/app/core/server.py", line 145, in on_startup pandabi-backend | await init_database() pandabi-backend | File "/app/core/server.py", line 113, in init_database pandabi-backend | user = await init_user() pandabi-backend | ^^^^^^^^^^^^^^^^^ pandabi-backend | File "/app/core/server.py", line 81, in init_user pandabi-backend | await controller.create_default_user() pandabi-backend | File "/app/core/database/transactional.py", line 40, in decorator pandabi-backend | raise exception pandabi-backend | File "/app/core/database/transactional.py", line 27, in decorator pandabi-backend | result = await self._run_required_new( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/app/core/database/transactional.py", line 53, in _run_required_new pandabi-backend | result = await function(*args, kwargs) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/app/app/controllers/user.py", line 21, in create_default_user pandabi-backend | users = await self.getall(limit=1, join={"memberships"}) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/app/core/controller/base.py", line 69, in get_all pandabi-backend | response = await self.repository.getall(skip, limit, join) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/app/core/repository/base.py", line 48, in get_all pandabi-backend | return await self._all_unique(query) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/app/core/repository/base.py", line 124, in _all_unique pandabi-backend | result = await self.session.execute(query) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/scoping.py", line 589, in execute pandabi-backend | return await self._proxied.execute( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/ext/asyncio/session.py", line 461, in execute pandabi-backend | result = await greenlet_spawn( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 201, in greenlet_spawn pandabi-backend | result = context.throw(*sys.exc_info()) pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2351, in execute pandabi-backend | return self._execute_internal( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/session.py", line 2236, in _execute_internal pandabi-backend | result: Result[Any] = compile_state_cls.orm_execute_statement( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement pandabi-backend | result = conn.execute( pandabi-backend | ^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1418, in execute pandabi-backend | return meth( pandabi-backend | ^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection pandabi-backend | return connection._execute_clauseelement( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1640, in _execute_clauseelement pandabi-backend | ret = self._execute_context( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1846, in _execute_context pandabi-backend | return self._exec_single_context( pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1986, in _exec_single_context pandabi-backend | self._handle_dbapi_exception( pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2353, in _handle_dbapi_exception pandabi-backend | raise sqlalchemy_exception.with_traceback(exc_info[2]) from e pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 1967, in _exec_single_context pandabi-backend | self.dialect.do_execute( pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 924, in do_execute pandabi-backend | cursor.execute(statement, parameters) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 572, in execute pandabi-backend | self._adaptconnection.await( pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 132, in await_only pandabi-backend | return current.parent.switch(awaitable) # type: ignore[no-any-return,attr-defined] # noqa: E501 pandabi-backend | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/util/_concurrency_py3k.py", line 196, in greenlet_spawn pandabi-backend | value = await result pandabi-backend | ^^^^^^^^^^^^ pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 550, in _prepare_and_execute pandabi-backend | self._handle_exception(error) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 501, in _handle_exception pandabi-backend | self._adapt_connection._handle_exception(error) pandabi-backend | File "/root/.cache/pypoetry/virtualenvs/pandasai-server-9TtSrW0h-py3.11/lib/python3.11/site-packages/sqlalchemy/dialects/postgresql/asyncpg.py", line 784, in _handle_exception pandabi-backend | raise translated_error from error pandabi-backend | sqlalchemy.exc.ProgrammingError: (sqlalchemy.dialects.postgresql.asyncpg.ProgrammingError) <class 'asyncpg.exceptions.UndefinedTableError'>: relation "user" does not exist pandabi-backend | [SQL: SELECT anon_1.id, anon_1.email, anon_1.first_name, anon_1.created_at, anon_1.password, anon_1.verified, anon_1.last_name, anon_1.features, organization_1.id AS id_1, organization_1.name, organization_1.url, organization_1.is_default, organization_1.settings, organization_membership_1.id AS id_2, organization_membership_1.user_id, organization_membership_1.organization_id, organization_membership_1.role, organization_membership_1.verified AS verified_1 pandabi-backend | FROM (SELECT "user".id AS id, "user".email AS email, "user".first_name AS first_name, "user".created_at AS created_at, "user".password AS password, "user".verified AS verified, "user".last_name AS last_name, "user".features AS features pandabi-backend | FROM "user" pandabi-backend | LIMIT $1::INTEGER OFFSET $2::INTEGER) AS anon_1 LEFT OUTER JOIN organization_membership AS organization_membership_1 ON anon_1.id = organization_membership_1.user_id LEFT OUTER JOIN organization AS organization_1 ON organization_1.id = organization_membership_1.organization_id] pandabi-backend | [parameters: (1, 0)] pandabi-backend | (Background on this error at: https://sqlalche.me/e/20/f405) pandabi-backend | pandabi-backend | ERROR: Application startup failed. Exiting.

dosubot[bot] commented 4 weeks ago

Hey there, @hamxahbhatti! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's tackle this issue together!

To resolve the Docker Compose build issue with the Pandas AI platform's backend service, follow these steps:

  1. ModuleNotFoundError for 'app' module:

    • Ensure the app module is included in your Docker image. Check your Dockerfile to confirm that the directory containing the app module is copied into the Docker image. For example, if your app module is in a directory named src, your Dockerfile should have a line like:
      COPY src/ /app/src/
    • Verify that the PYTHONPATH is set correctly in your Docker environment to include the directory where the app module resides.
  2. UndefinedTableError for the "user" relation:

    • This error suggests that the database schema is not set up correctly. Ensure that database migrations are applied before starting the application. If you are using Alembic for migrations, add a command in your Dockerfile or docker-compose.yml to run the migrations, such as:
      RUN alembic upgrade head
    • Make sure the database service is up and running before the application tries to connect to it. Use Docker Compose's depends_on to ensure the database service starts before the application service.

By addressing these issues, you should be able to resolve the build problem and successfully start the backend service [1].

To continue talking to Dosu, mention @dosu.

toeng69 commented 3 weeks ago

Same error guys, I've tried the methods in the comments but it still doesn't work