QuivrHQ / quivr

Open-source RAG Framework for building GenAI Second Brains 🧠 Build productivity assistant (RAG) ⚡️🤖 Chat with your docs (PDF, CSV, ...) & apps using Langchain, GPT 3.5 / 4 turbo, Private, Anthropic, VertexAI, Ollama, LLMs, Groq that you can share with users ! Efficient retrieval augmented generation framework
https://quivr.com
Other
36.32k stars 3.54k forks source link

Issue: Installation of Quivr Failing Due to Missing backend-base:latest Image #2950

Closed sNor4pro closed 1 month ago

sNor4pro commented 2 months ago

What happened?

Issue: Installation of Quivr Failing Due to Missing backend-base:latest Image

Hello,

I encountered an issue while trying to install Quivr on a fresh installation of POP!_OS and Ubuntu. Both attempts failed at the same point: Docker could not find the backend-base:latest image.

Steps Taken

  1. Attempted to install Quivr using the standard installation procedure.
  2. Encountered the following error: No such image: backend-base:latest.
  3. Tried manually installing the image, but it appears to have been deleted or is otherwise unavailable.

Question

Is there an alternative way to install Quivr or a workaround for this issue? Any guidance or updated instructions would be greatly appreciated.

Thank you!

Relevant log output

anon@anon:~/quivr$ docker compose up
WARN[0000] /home/mike/quivr/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion 
[+] Building 104.4s (23/23) FINISHED                                                                                                                          docker:default
 => [frontend internal] load build definition from Dockerfile                                                                                                           0.2s
 => => transferring dockerfile: 2.90kB                                                                                                                                  0.0s
 => [frontend internal] load metadata for docker.io/library/node:18.19.0-alpine                                                                                         1.6s
 => [frontend internal] load .dockerignore                                                                                                                              0.1s
 => => transferring context: 340B                                                                                                                                       0.0s
 => [frontend base 1/1] FROM docker.io/library/node:18.19.0-alpine@sha256:0085670310d2879621f96a4216c893f92e2ded827e9e6ef8437672e1bd72f437                              2.7s
 => => resolve docker.io/library/node:18.19.0-alpine@sha256:0085670310d2879621f96a4216c893f92e2ded827e9e6ef8437672e1bd72f437                                            0.1s
 => => sha256:0085670310d2879621f96a4216c893f92e2ded827e9e6ef8437672e1bd72f437 1.43kB / 1.43kB                                                                          0.0s
 => => sha256:aacbcec05180c1dd8c33dba8a9c42b75dbfdd659aa57617497f1ce2c5d83d889 1.16kB / 1.16kB                                                                          0.0s
 => => sha256:c8eb770fbfacf54104162cc9035c478ddb7d8dc15dca5298af028257f1dbdb3f 7.14kB / 7.14kB                                                                          0.0s
 => => sha256:eb6c7c29ba4d368f2428cacd291f7821b750fac3b1fb65b937ef855c573cdf97 40.24MB / 40.24MB                                                                        1.1s
 => => sha256:3d4a65156edf0208c8421995310d9e662e7ee63e2bcae660efb02f6c4ddef6a9 2.34MB / 2.34MB                                                                          0.5s
 => => sha256:5bdb6c27eb32087b71a9dde411c1f1eeb87563c0445f89db4eb7639d2cf50f45 450B / 450B                                                                              0.6s
 => => extracting sha256:eb6c7c29ba4d368f2428cacd291f7821b750fac3b1fb65b937ef855c573cdf97                                                                               0.8s
 => => extracting sha256:3d4a65156edf0208c8421995310d9e662e7ee63e2bcae660efb02f6c4ddef6a9                                                                               0.1s
 => => extracting sha256:5bdb6c27eb32087b71a9dde411c1f1eeb87563c0445f89db4eb7639d2cf50f45                                                                               0.0s
 => [frontend internal] load build context                                                                                                                              0.2s
 => => transferring context: 5.12MB                                                                                                                                     0.1s
 => [frontend deps 1/5] RUN apk add --no-cache libc6-compat python3 make g++                                                                                            4.0s
 => [frontend builder 1/4] WORKDIR /app                                                                                                                                 0.4s
 => [frontend runner 2/8] RUN addgroup --system --gid 1001 nodejs                                                                                                       0.4s
 => [frontend runner 3/8] RUN adduser --system --uid 1001 nextjs                                                                                                        0.4s
 => [frontend deps 2/5] RUN yarn global add node-gyp                                                                                                                    3.1s 
 => [frontend deps 3/5] WORKDIR /app                                                                                                                                    0.2s 
 => [frontend deps 4/5] COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./                                                                              0.2s 
 => [frontend deps 5/5] RUN     if [ -f yarn.lock ]; then yarn --frozen-lockfile;     elif [ -f package-lock.json ]; then npm ci;     elif [ -f pnpm-lock.yaml ]; the  35.7s 
 => [frontend builder 2/4] COPY --from=deps /app/node_modules ./node_modules                                                                                            2.8s 
 => [frontend builder 3/4] COPY . .                                                                                                                                     0.2s 
 => [frontend builder 4/4] RUN yarn build                                                                                                                              48.9s 
 => [frontend runner 4/8] COPY --from=builder /app/public ./public                                                                                                      0.2s 
 => [frontend runner 5/8] RUN mkdir .next                                                                                                                               0.5s 
 => [frontend runner 6/8] RUN chown nextjs:nodejs .next                                                                                                                 0.5s 
 => [frontend runner 7/8] COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./                                                                            0.3s 
 => [frontend runner 8/8] COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static                                                                    0.2s 
 => [frontend] exporting to image                                                                                                                                       0.5s 
 => => exporting layers                                                                                                                                                 0.4s
 => => writing image sha256:e830f1cb24af97621d40c7ea74378e9df1d108157ad256caf43d42a2ea065fbb                                                                            0.0s
 => => naming to docker.io/library/quivr-frontend-prebuilt                                                                                                              0.0s
 => [frontend] resolving provenance for metadata file                                                                                                                   0.0s
[+] Running 6/6
 ✔ Network quivr_default   Created                                                                                                                                      0.1s 
 ✔ Container redis         Created                                                                                                                                      0.3s 
 ✔ Container backend-core  Created                                                                                                                                      0.2s 
 ✔ Container web           Created                                                                                                                                      0.2s 
 ✔ Container worker        Created                                                                                                                                      0.2s 
 ✔ Container beat          Created                                                                                                                                      0.2s 
 ⠋ Container notifier      Creating                                                                                                                                     0.0s 
 ⠋ Container flower        Creating                                                                                                                                     0.0s 
Error response from daemon: No such image: backend-base:latest

----------------
anon@anon:~/quivr$ docker pull backend-base:latest
Error response from daemon: pull access denied for backend-base, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

Twitter / LinkedIn details

No response

linear[bot] commented 2 months ago

TICK-39 Issue: Installation of Quivr Failing Due to Missing backend-base:latest Image

dosubot[bot] commented 2 months ago

Hey there, @sNor4pro! I'm here to help with any bugs, questions, or contributions you have regarding the Quivr project. Let's get that issue sorted out for you.

To address the issue where Docker cannot find the backend-base:latest image, you can modify the docker-compose.yml file to build the image locally instead of pulling it from a remote repository. Here is an alternative way to install Quivr by ensuring the backend image is built locally:

version: "3.8"

services:
  frontend:
    image: quivr-frontend-prebuilt
    pull_policy: never
    build:
      context: frontend
      dockerfile: Dockerfile
      args:
        - NEXT_PUBLIC_ENV=local
        - NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL}
        - NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}
        - NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
        - NEXT_PUBLIC_CMS_URL=${NEXT_PUBLIC_CMS_URL}
        - NEXT_PUBLIC_FRONTEND_URL=${NEXT_PUBLIC_FRONTEND_URL}
        - NEXT_PUBLIC_AUTH_MODES=${NEXT_PUBLIC_AUTH_MODES}
    container_name: web
    depends_on:
      - backend-core
    restart: always
    ports:
      - 3000:3000

  backend-core:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: backend-core
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      test: [ "CMD", "curl", "http://localhost:5050/healthz" ]
    command:
      - "uvicorn"
      - "main:app"
      - "--host"
      - "0.0.0.0"
      - "--port"
      - "5050"
      - "--workers"
      - "6"
    restart: always
    volumes:
      - ./backend/:/code/
    ports:
      - 5050:5050

  redis:
    image: redis:latest@sha256:a7cee7c8178ff9b5297cb109e6240f5072cdaaafd775ce6b586c3c704b06458e
    container_name: redis
    restart: always
    ports:
      - 6379:6379

  worker:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: worker
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command: celery -A celery_worker worker -l info
    restart: always
    depends_on:
      - redis

  beat:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: beat
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command: celery -A celery_worker beat -l info
    restart: always
    depends_on:
      - redis

  flower:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: flower
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command: celery -A celery_worker flower -l info --port=5555
    restart: always
    depends_on:
      - redis
      - worker
      - beat
    ports:
      - 5555:5555

networks:
  quivr-network:
    driver: bridge

In this configuration, the backend-core, worker, beat, and flower services are set to build the Docker image locally using the Dockerfile in the backend directory. This should resolve the issue of Docker not finding the backend-base:latest image [1].

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

it now spams the whole time, is this correct?: @dosu Webinterface from Quivr works, create brain doesn't.

Attaching to backend-core, beat, flower, redis, web, worker
redis | 1:C 06 Aug 2024 19:42:47.576 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis | 1:C 06 Aug 2024 19:42:47.577 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis | 1:C 06 Aug 2024 19:42:47.577 * Redis version=7.2.3, bits=64, commit=00000000, modified=0, pid=1, just started
redis | 1:C 06 Aug 2024 19:42:47.577 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis | 1:M 06 Aug 2024 19:42:47.577 * monotonic clock: POSIX clock_gettime
redis | 1:M 06 Aug 2024 19:42:47.577 * Running mode=standalone, port=6379.
redis | 1:M 06 Aug 2024 19:42:47.577 * Server initialized
redis | 1:M 06 Aug 2024 19:42:47.577 * Loading RDB produced by version 7.2.3
redis | 1:M 06 Aug 2024 19:42:47.577 * RDB age 4 seconds
redis | 1:M 06 Aug 2024 19:42:47.577 * RDB memory usage when created 0.83 Mb
redis | 1:M 06 Aug 2024 19:42:47.577 * Done loading RDB, keys loaded: 0, keys expired: 0.
redis | 1:M 06 Aug 2024 19:42:47.577 * DB loaded from disk: 0.000 seconds
redis | 1:M 06 Aug 2024 19:42:47.577 * Ready to accept connections tcp
backend-core | INFO: Uvicorn running on http://0.0.0.0:5050/ (Press CTRL+C to quit)
backend-core | INFO: Started parent process [1]
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
web | ▲ Next.js 14.1.0
web | - Local: http://localhost:3000/
web | - Network: http://0.0.0.0:3000/
web |
web | ✓ Ready in 43ms
backend-core | INFO: Waiting for child process [8]
backend-core | INFO: Child process [8] died
backend-core | INFO: Waiting for child process [9]
backend-core | INFO: Child process [9] died
backend-core | INFO: Waiting for child process [10]
backend-core | INFO: Child process [10] died
backend-core | INFO: Waiting for child process [11]
backend-core | INFO: Child process [11] died
backend-core | INFO: Waiting for child process [12]
backend-core | INFO: Child process [12] died
backend-core | INFO: Waiting for child process [13]
backend-core | INFO: Child process [13] died
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
beat | Usage: celery [OPTIONS] COMMAND [ARGS]...
beat | Try 'celery --help' for help.
beat |
beat | Error: Invalid value for '-A' / '--app':
beat | Unable to load celery application.
beat | The module celery_worker was not found.
worker | Usage: celery [OPTIONS] COMMAND [ARGS]...
worker | Try 'celery --help' for help.
worker |
worker | Error: Invalid value for '-A' / '--app':
worker | Unable to load celery application.
worker | The module celery_worker was not found.
backend-core | INFO: Waiting for child process [9]
backend-core | INFO: Child process [9] died
backend-core | INFO: Waiting for child process [11]
backend-core | INFO: Child process [11] died
backend-core | INFO: Waiting for child process [13]
backend-core | INFO: Child process [13] died
backend-core | INFO: Waiting for child process [21]
backend-core | INFO: Child process [21] died
backend-core | INFO: Waiting for child process [23]
backend-core | INFO: Child process [23] died
backend-core | INFO: Waiting for child process [25]
backend-core | INFO: Child process [25] died
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
flower | Usage: celery [OPTIONS] COMMAND [ARGS]...
flower | Try 'celery --help' for help.
flower |
flower | Error: Invalid value for '-A' / '--app':
flower | Unable to load celery application.
flower | The module celery_worker was not found.
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
backend-core | ERROR: Error loading ASGI app. Could not import module "main".
beat exited with code 0
worker exited with code 0
backend-core | INFO: Waiting for child process [11]
dosubot[bot] commented 2 months ago

The errors you're encountering indicate that the backend-core service is unable to import the "main" module, and the worker, beat, and flower services are unable to load the celery_worker module. Here are steps to resolve these issues:

  1. Check Directory Structure: Ensure that the backend directory contains the main.py and celery_worker.py files. The structure should look like this:

    backend/
    ├── main.py
    └── celery_worker.py
  2. Verify Module Paths: Ensure that the main.py file contains the app object, and the celery_worker.py file is correctly set up for Celery.

  3. Check Volume Mounts: Ensure that the code is correctly mounted and accessible within the container. The volumes directive in the docker-compose.yml file should mount the ./backend/ directory to /code/ in the container.

  4. Inspect Docker Logs: Check the logs of the failing services to get more details about the import errors. You can use the following commands:

    docker-compose logs backend-core
    docker-compose logs worker
    docker-compose logs beat
    docker-compose logs flower
  5. Example main.py: Here is an example of what the main.py file might look like:

    from fastapi import FastAPI
    
    app = FastAPI()
    
    @app.get("/")
    def read_root():
       return {"Hello": "World"}
  6. Example celery_worker.py: Here is an example of what the celery_worker.py file might look like:

    from celery import Celery
    
    celery = Celery('celery_worker', broker='pyamqp://guest@localhost//')
    
    @celery.task
    def add(x, y):
       return x + y

By ensuring the directory structure is correct, the module paths are properly set up, and using the manage_services.sh script to manage your services, you should be able to resolve the import issues for the backend-core, worker, beat, and flower services [1].

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

I don't see these files in the folder.

See below:

mike@pc:~/quivr/backend$ ls
api              core        Dockerfile.dev  poetry.toml     supabase
ci-migration.sh  Dockerfile  poetry.lock     pyproject.toml

snipped from docker-compose logs backend-core

backend-core  | INFO:     Child process [796] died
backend-core  | INFO:     Waiting for child process [808]
backend-core  | INFO:     Child process [808] died
backend-core  | INFO:     Waiting for child process [812]
backend-core  | INFO:     Child process [812] died
backend-core  | INFO:     Waiting for child process [820]
backend-core  | INFO:     Child process [820] died
backend-core  | INFO:     Waiting for child process [822]
backend-core  | INFO:     Child process [822] died
backend-core  | INFO:     Waiting for child process [824]
backend-core  | INFO:     Child process [824] died
backend-core  | ERROR:    Error loading ASGI app. Could not import module "main".
backend-core  | ERROR:    Error loading ASGI app. Could not import module "main".
backend-core  | ERROR:    Error loading ASGI app. Could not import module "main".
backend-core  | ERROR:    Error loading ASGI app. Could not import module "main".
backend-core  | ERROR:    Error loading ASGI app. Could not import module "main".
backend-core  | ERROR:    Error loading ASGI app. Could not import module "main".
backend-core  | INFO:     Received SIGTERM, exiting.
backend-core  | INFO:     Waiting for child process [808]
backend-core  | INFO:     Waiting for child process [820]
backend-core  | INFO:     Waiting for child process [824]
backend-core  | INFO:     Waiting for child process [832]
backend-core  | INFO:     Waiting for child process [834]
backend-core  | INFO:     Waiting for child process [836]
backend-core  | INFO:     Stopping parent process [1]
mike@pc:~/quivr/backend$ 

snipped from worker log:

worker  | Error: Invalid value for '-A' / '--app': 
worker  | Unable to load celery application.
worker  | The module celery_worker was not found.
worker  | Usage: celery [OPTIONS] COMMAND [ARGS]...
worker  | Try 'celery --help' for help.
worker  | 
worker  | Error: Invalid value for '-A' / '--app': 
worker  | Unable to load celery application.
worker  | The module celery_worker was not found.
worker  | Usage: celery [OPTIONS] COMMAND [ARGS]...
worker  | Try 'celery --help' for help.
worker  | 
worker  | Error: Invalid value for '-A' / '--app': 
worker  | Unable to load celery application.
worker  | The module celery_worker was not found.

snipped from beat log:

beat  | Unable to load celery application.
beat  | The module celery_worker was not found.
beat  | Usage: celery [OPTIONS] COMMAND [ARGS]...
beat  | Try 'celery --help' for help.
beat  | 
beat  | Error: Invalid value for '-A' / '--app': 
beat  | Unable to load celery application.
beat  | The module celery_worker was not found.
beat  | Usage: celery [OPTIONS] COMMAND [ARGS]...
beat  | Try 'celery --help' for help.
beat  | 
beat  | Error: Invalid value for '-A' / '--app': 
beat  | Unable to load celery application.
beat  | The module celery_worker was not found.
beat  | Usage: celery [OPTIONS] COMMAND [ARGS]...
beat  | Try 'celery --help' for help.
beat  | 
beat  | Error: Invalid value for '-A' / '--app': 
beat  | Unable to load celery application.
beat  | The module celery_worker was not found.

snipped from flower log:

flower  | Unable to load celery application.
flower  | The module celery_worker was not found.
flower  | Usage: celery [OPTIONS] COMMAND [ARGS]...
flower  | Try 'celery --help' for help.
flower  | 
flower  | Error: Invalid value for '-A' / '--app': 
flower  | Unable to load celery application.
flower  | The module celery_worker was not found.
flower  | Usage: celery [OPTIONS] COMMAND [ARGS]...
flower  | Try 'celery --help' for help.
flower  | 
flower  | Error: Invalid value for '-A' / '--app': 
flower  | Unable to load celery application.
flower  | The module celery_worker was not found.

Can I simply create them? I used your docker-compose. @dosu

dosubot[bot] commented 2 months ago

The errors indicate that the main.py and celery_worker.py files are missing from the backend directory. You can create these files with the following content:

main.py

This file sets up a basic FastAPI application.

from fastapi import FastAPI

app = FastAPI()

@app.get("/healthz")
def read_healthz():
    return {"status": "ok"}

celery_worker.py

This file sets up a basic Celery worker.

from celery import Celery

celery = Celery('celery_worker', broker='redis://redis:6379/0')

@celery.task
def add(x, y):
    return x + y

Directory Structure

Ensure your backend directory looks like this:

backend/
├── api
├── core
├── Dockerfile
├── Dockerfile.dev
├── poetry.lock
├── poetry.toml
├── pyproject.toml
├── supabase
├── main.py
└── celery_worker.py

Dockerfile

Ensure your Dockerfile in the backend directory copies these files correctly:

FROM python:3.9-slim

WORKDIR /code

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050", "--workers", "6"]

docker-compose.yml

Ensure your docker-compose.yml is correctly configured. Here is an example configuration:

version: "3.8"

services:
  backend-core:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: backend-core
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      test: [ "CMD", "curl", "http://localhost:5050/healthz" ]
    command:
      - "uvicorn"
      - "main:app"
      - "--host"
      - "0.0.0.0"
      - "--port"
      - "5050"
      - "--workers"
      - "6"
    restart: always
    volumes:
      - ./backend/:/code/
    ports:
      - 5050:5050

  redis:
    image: redis:latest
    container_name: redis
    restart: always
    ports:
      - 6379:6379

  worker:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: worker
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command: celery -A celery_worker worker -l info
    restart: always
    depends_on:
      - redis

  beat:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: beat
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command: celery -A celery_worker beat -l info
    restart: always
    depends_on:
      - redis

  flower:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: flower
    extra_hosts:
      - "host.docker.internal:host-gateway"
    command: celery -A celery_worker flower -l info --port=5555
    restart: always
    depends_on:
      - redis
      - worker
      - beat
    ports:
      - 5555:5555

By creating these files and ensuring the correct configuration, the backend-core, worker, beat, and flower services should function correctly [1][2][3].

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

this is my docker, looks like something is missing: @dosu

# Using a slim version for a smaller base image
FROM python:3.11.6-slim-bullseye

ARG DEV_MODE
ENV DEV_MODE=$DEV_MODE

# Install GEOS library, Rust, and other dependencies, then clean up
RUN apt-get clean && apt-get update && apt-get install -y \
    libgeos-dev \
    libcurl4-openssl-dev \
    libssl-dev \
    binutils \
    pandoc \
    curl \
    git \
    poppler-utils \
    tesseract-ocr \
    autoconf \
    automake \
    build-essential \
    libtool \
    python-dev \
    wget \
    # Additional dependencies for document handling
    libmagic-dev \
    poppler-utils \
    tesseract-ocr \
    libreoffice \
    libpq-dev \
    gcc \
    pandoc && \
    rm -rf /var/lib/apt/lists/*

RUN ARCHITECTURE=$(uname -m) && \
    if [ "$ARCHITECTURE" = "x86_64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb && \
    dpkg -i supabase_1.163.6_linux_amd64.deb && \
    rm supabase_1.163.6_linux_amd64.deb; \
    elif [ "$ARCHITECTURE" = "aarch64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb && \
    dpkg -i supabase_1.163.6_linux_arm64.deb && \
    rm supabase_1.163.6_linux_arm64.deb; \
    fi && \
    rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

# Add Rust binaries to the PATH
ENV PATH="/root/.cargo/bin:${PATH}" \
    POETRY_CACHE_DIR=/tmp/poetry_cache \
    PYTHONDONTWRITEBYTECODE=1

WORKDIR /code

# Copy monorepo dependencies
# CORE
COPY core/pyproject.toml core/README.md core/poetry.lock  /code/core/
COPY core/quivr_core /code/core/quivr_core
# API
COPY api/pyproject.toml  api/poetry.lock api/README.md /code/api/
COPY api/quivr_api /code/api/quivr_api

COPY ./pyproject.toml ./poetry.lock* /code/

COPY ./ci-migration.sh /code/

COPY supabase /code/supabase/

# Run install
RUN poetry install --no-root --with dev,test && \
    playwright install --with-deps && \
    rm -rf $POETRY_CACHE_DIR

ENV PYTHONPATH=/code

EXPOSE 5050 
dosubot[bot] commented 2 months ago

It looks like your Dockerfile is missing the steps to copy and set up the main.py and celery_worker.py files. Here are the steps to update your Dockerfile and ensure these files are included:

Updated Dockerfile

Add the following lines to copy the main.py and celery_worker.py files and set the entry point for the application:

# Using a slim version for a smaller base image
FROM python:3.11.6-slim-bullseye

ARG DEV_MODE
ENV DEV_MODE=$DEV_MODE

# Install GEOS library, Rust, and other dependencies, then clean up
RUN apt-get clean && apt-get update && apt-get install -y \
    libgeos-dev \
    libcurl4-openssl-dev \
    libssl-dev \
    binutils \
    pandoc \
    curl \
    git \
    poppler-utils \
    tesseract-ocr \
    autoconf \
    automake \
    build-essential \
    libtool \
    python-dev \
    wget \
    # Additional dependencies for document handling
    libmagic-dev \
    poppler-utils \
    tesseract-ocr \
    libreoffice \
    libpq-dev \
    gcc \
    pandoc && \
    rm -rf /var/lib/apt/lists/*

RUN ARCHITECTURE=$(uname -m) && \
    if [ "$ARCHITECTURE" = "x86_64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb && \
    dpkg -i supabase_1.163.6_linux_amd64.deb && \
    rm supabase_1.163.6_linux_amd64.deb; \
    elif [ "$ARCHITECTURE" = "aarch64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb && \
    dpkg -i supabase_1.163.6_linux_arm64.deb && \
    rm supabase_1.163.6_linux_arm64.deb; \
    fi && \
    rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

# Add Rust binaries to the PATH
ENV PATH="/root/.cargo/bin:${PATH}" \
    POETRY_CACHE_DIR=/tmp/poetry_cache \
    PYTHONDONTWRITEBYTECODE=1

WORKDIR /code

# Copy monorepo dependencies
# CORE
COPY core/pyproject.toml core/README.md core/poetry.lock  /code/core/
COPY core/quivr_core /code/core/quivr_core
# API
COPY api/pyproject.toml  api/poetry.lock api/README.md /code/api/
COPY api/quivr_api /code/api/quivr_api

COPY ./pyproject.toml ./poetry.lock* /code/

COPY ./ci-migration.sh /code/

COPY supabase /code/supabase/

# Copy main.py and celery_worker.py
COPY main.py /code/
COPY celery_worker.py /code/

# Run install
RUN poetry install --no-root --with dev,test && \
    playwright install --with-deps && \
    rm -rf $POETRY_CACHE_DIR

ENV PYTHONPATH=/code

EXPOSE 5050

# Set the entry point for the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050"]

main.py

Create a main.py file with the following content:

from fastapi import FastAPI

app = FastAPI()

@app.get("/healthz")
def read_healthz():
    return {"status": "ok"}

celery_worker.py

Create a celery_worker.py file with the following content:

from celery import Celery

celery = Celery('celery_worker', broker='redis://redis:6379/0')

@celery.task
def add(x, y):
    return x + y

Directory Structure

Ensure your backend directory looks like this:

backend/
├── api
├── core
├── Dockerfile
├── Dockerfile.dev
├── poetry.lock
├── poetry.toml
├── pyproject.toml
├── supabase
├── main.py
└── celery_worker.py

By updating your Dockerfile to include the main.py and celery_worker.py files and ensuring the correct directory structure, the backend-core, worker, beat, and flower services should function correctly [1][2].

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

No error spams anymore, this is good, but now i can't create a brain or make go into my profile see: @dosu

backend-core  | INFO:     172.19.0.1:38630 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38632 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:33406 - "OPTIONS /user HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38630 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38632 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:33406 - "OPTIONS /user HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38630 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38632 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:33406 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38630 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38632 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:33406 - "OPTIONS /user HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38630 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:38632 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     127.0.0.1:56878 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/credits HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59802 - "OPTIONS /user/identity HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:59806 - "OPTIONS /onboarding HTTP/1.1" 404 Not Found
dosubot[bot] commented 2 months ago

The 404 errors indicate that the endpoints for /user, /user/identity, /user/credits, and /onboarding are not defined in your FastAPI application. You need to ensure that these endpoints are correctly implemented in your main.py or other relevant files.

Here is an example of how you can define these endpoints in your main.py:

main.py

from fastapi import FastAPI, HTTPException

app = FastAPI()

@app.get("/healthz")
def read_healthz():
    return {"status": "ok"}

@app.options("/user")
def options_user():
    return {"status": "ok"}

@app.options("/user/identity")
def options_user_identity():
    return {"status": "ok"}

@app.options("/user/credits")
def options_user_credits():
    return {"status": "ok"}

@app.options("/onboarding")
def options_onboarding():
    return {"status": "ok"}

@app.get("/user/identity")
def get_user_identity():
    # Implement your logic here
    return {"identity": "user_identity"}

@app.get("/user/credits")
def get_user_credits():
    # Implement your logic here
    return {"credits": "user_credits"}

@app.get("/onboarding")
def get_onboarding():
    # Implement your logic here
    return {"onboarding": "onboarding_info"}

Directory Structure

Ensure your backend directory looks like this:

backend/
├── api
├── core
├── Dockerfile
├── Dockerfile.dev
├── poetry.lock
├── poetry.toml
├── pyproject.toml
├── supabase
├── main.py
└── celery_worker.py

Dockerfile

Ensure your Dockerfile in the backend directory copies these files correctly:

# Using a slim version for a smaller base image
FROM python:3.11.6-slim-bullseye

ARG DEV_MODE
ENV DEV_MODE=$DEV_MODE

# Install GEOS library, Rust, and other dependencies, then clean up
RUN apt-get clean && apt-get update && apt-get install -y \
    libgeos-dev \
    libcurl4-openssl-dev \
    libssl-dev \
    binutils \
    pandoc \
    curl \
    git \
    poppler-utils \
    tesseract-ocr \
    autoconf \
    automake \
    build-essential \
    libtool \
    python-dev \
    wget \
    # Additional dependencies for document handling
    libmagic-dev \
    poppler-utils \
    tesseract-ocr \
    libreoffice \
    libpq-dev \
    gcc \
    pandoc && \
    rm -rf /var/lib/apt/lists/*

RUN ARCHITECTURE=$(uname -m) && \
    if [ "$ARCHITECTURE" = "x86_64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb && \
    dpkg -i supabase_1.163.6_linux_amd64.deb && \
    rm supabase_1.163.6_linux_amd64.deb; \
    elif [ "$ARCHITECTURE" = "aarch64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb && \
    dpkg -i supabase_1.163.6_linux_arm64.deb && \
    rm supabase_1.163.6_linux_arm64.deb; \
    fi && \
    rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

# Add Rust binaries to the PATH
ENV PATH="/root/.cargo/bin:${PATH}" \
    POETRY_CACHE_DIR=/tmp/poetry_cache \
    PYTHONDONTWRITEBYTECODE=1

WORKDIR /code

# Copy monorepo dependencies
# CORE
COPY core/pyproject.toml core/README.md core/poetry.lock  /code/core/
COPY core/quivr_core /code/core/quivr_core
# API
COPY api/pyproject.toml  api/poetry.lock api/README.md /code/api/
COPY api/quivr_api /code/api/quivr_api

COPY ./pyproject.toml ./poetry.lock* /code/

COPY ./ci-migration.sh /code/

COPY supabase /code/supabase/

# Copy main.py and celery_worker.py
COPY main.py /code/
COPY celery_worker.py /code/

# Run install
RUN poetry install --no-root --with dev,test && \
    playwright install --with-deps && \
    rm -rf $POETRY_CACHE_DIR

ENV PYTHONPATH=/code

EXPOSE 5050

# Set the entry point for the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050"]

By defining these endpoints and ensuring the correct directory structure and Dockerfile configuration, the backend service should be able to handle the requests to /user, /user/identity, /user/credits, and /onboarding without returning 404 errors [1][2].

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

I edited the main.py and dockerfile with your data, stil the same issue: @dosu


backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /chat HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:49054 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49080 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49062 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /brains/ HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:49054 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49080 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49062 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user/credits HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user/credits HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49062 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49062 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /chat HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49062 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:45650 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /brains/ HTTP/1.1" 404 Not Found
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /onboarding HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:45650 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:49066 - "OPTIONS /user HTTP/1.1" 200 OK
backend-core  | INFO:     127.0.0.1:45450 - "GET /healthz HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:45840 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:45840 - "OPTIONS /user/identity HTTP/1.1" 200 OK
backend-core  | INFO:     172.19.0.1:45840 - "OPTIONS /user/identity HTTP/1.1" 200 OK
dosubot[bot] commented 2 months ago

It looks like the 404 errors for the /chat and /brains/ endpoints indicate that these endpoints are not defined in your FastAPI application. You need to ensure that these endpoints are correctly implemented and registered in your FastAPI router.

Define and Register Endpoints

  1. Create chat_routes.py and brain_routes.py: Ensure you have the following files in your backend/api/quivr_api/modules directory:

    • chat_routes.py
    • brain_routes.py
  2. Implement Endpoints in chat_routes.py: Here is an example of how you can define the /chat endpoints:

    from fastapi import APIRouter, Depends
    from some_auth_module import AuthBearer  # Replace with your actual auth module
    from some_user_module import get_current_user, UserIdentity  # Replace with your actual user module
    from some_chat_service import chat_service  # Replace with your actual chat service
    
    chat_router = APIRouter()
    
    @chat_router.post("/chat", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def create_chat(name: str, current_user: UserIdentity = Depends(get_current_user)):
       """Create a new chat."""
       created_chat = chat_service.create_chat(name, current_user.id)
       return {"chat": created_chat}
    
    @chat_router.get("/chat", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def get_chats(current_user: UserIdentity = Depends(get_current_user)):
       """Retrieve all chats for the current user."""
       chats = chat_service.get_chats(current_user.id)
       return {"chats": chats}
    
    @chat_router.delete("/chat/{chat_id}", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def delete_chat(chat_id: str, current_user: UserIdentity = Depends(get_current_user)):
       """Delete a specific chat."""
       chat_service.delete_chat(chat_id, current_user.id)
       return {"message": "Chat deleted"}
    
    @chat_router.post("/chat/{chat_id}/question", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def add_question(chat_id: str, brain_id: str, chat_question: ChatQuestion, current_user: UserIdentity = Depends(get_current_user)):
       """Add a question to a specific chat."""
       response = chat_service.add_question(chat_id, brain_id, chat_question, current_user.id)
       return {"response": response}
    
    @chat_router.get("/chat/{chat_id}/history", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def get_chat_items(chat_id: str, current_user: UserIdentity = Depends(get_current_user)):
       """Retrieve chat history for a specific chat."""
       chat_items = chat_service.get_chat_items(chat_id, current_user.id)
       return {"chat_items": chat_items}
    
    @chat_router.put("/chat/{chat_id}/metadata", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def update_chat(chat_id: str, chat: ChatUpdatableProperties, current_user: UserIdentity = Depends(get_current_user)):
       """Update chat metadata."""
       updated_chat = chat_service.update_chat(chat_id, chat, current_user.id)
       return {"chat": updated_chat}
    
    @chat_router.put("/chat/{chat_id}/{message_id}", dependencies=[Depends(AuthBearer())], tags=["Chat"])
    async def update_chat_message(chat_id: str, message_id: str, chat_message_updatable_properties: ChatMessageUpdatableProperties, current_user: UserIdentity = Depends(get_current_user)):
       """Update a specific chat message."""
       updated_message = chat_service.update_chat_message(chat_id, message_id, chat_message_updatable_properties, current_user.id)
       return {"message": updated_message}
  3. Implement Endpoints in brain_routes.py: Here is an example of how you can define the /brains/ endpoints:

    from fastapi import APIRouter, Depends
    from some_auth_module import AuthBearer  # Replace with your actual auth module
    from some_user_module import get_current_user, UserIdentity  # Replace with your actual user module
    from some_brain_service import brain_user_service  # Replace with your actual brain service
    
    brain_router = APIRouter()
    
    @brain_router.get("/brains/", dependencies=[Depends(AuthBearer())], tags=["Brain"])
    async def retrieve_all_brains_for_user(current_user: UserIdentity = Depends(get_current_user)):
       """Retrieve all brains for the current user."""
       brains = brain_user_service.get_user_brains(current_user.id)
       return {"brains": brains}
  4. Register Routers in main.py: Ensure you register these routers in your main.py:

    from fastapi import FastAPI
    from backend.api.quivr_api.modules.chat_routes import chat_router
    from backend.api.quivr_api.modules.brain_routes import brain_router
    
    app = FastAPI()
    
    app.include_router(chat_router)
    app.include_router(brain_router)
    
    @app.get("/healthz")
    def read_healthz():
       return {"status": "ok"}
  5. Update Dockerfile: Ensure your Dockerfile is correctly set up to copy all necessary files:

    # Using a slim version for a smaller base image
    FROM python:3.11.6-slim-bullseye
    
    ARG DEV_MODE
    ENV DEV_MODE=$DEV_MODE
    
    # Install dependencies
    RUN apt-get clean && apt-get update && apt-get install -y \
       libgeos-dev \
       libcurl4-openssl-dev \
       libssl-dev \
       binutils \
       pandoc \
       curl \
       git \
       poppler-utils \
       tesseract-ocr \
       autoconf \
       automake \
       build-essential \
       libtool \
       python-dev \
       wget \
       libmagic-dev \
       poppler-utils \
       tesseract-ocr \
       libreoffice \
       libpq-dev \
       gcc \
       pandoc && \
       rm -rf /var/lib/apt/lists/*
    
    RUN ARCHITECTURE=$(uname -m) && \
       if [ "$ARCHITECTURE" = "x86_64" ]; then \
       wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb && \
       dpkg -i supabase_1.163.6_linux_amd64.deb && \
       rm supabase_1.163.6_linux_amd64.deb; \
       elif [ "$ARCHITECTURE" = "aarch64" ]; then \
       wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb && \
       dpkg -i supabase_1.163.6_linux_arm64.deb && \
       rm supabase_1.163.6_linux_arm64.deb; \
       fi && \
       rm -rf /var/lib/apt/lists/*
    
    RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
       cd /usr/local/bin && \
       ln -s /opt/poetry/bin/poetry && \
       poetry config virtualenvs.create false
    
    # Add Rust binaries to the PATH
    ENV PATH="/root/.cargo/bin:${PATH}" \
       POETRY_CACHE_DIR=/tmp/poetry_cache \
       PYTHONDONTWRITEBYTECODE=1
    
    WORKDIR /code
    
    # Copy monorepo dependencies
    # CORE
    COPY core/pyproject.toml core/README.md core/poetry.lock  /code/core/
    COPY core/quivr_core /code/core/quivr_core
    # API
    COPY api/pyproject.toml  api/poetry.lock api/README.md /code/api/
    COPY api/quivr_api /code/api/quivr_api
    
    COPY ./pyproject.toml ./poetry.lock* /code/
    
    COPY ./ci-migration.sh /code/
    
    COPY supabase /code/supabase/
    
    # Copy main.py and celery_worker.py
    COPY main.py /code/
    COPY celery_worker.py /code/
    
    # Run install
    RUN poetry install --no-root --with dev,test && \
       playwright install --with-deps && \
       rm -rf $POETRY_CACHE_DIR
    
    ENV PYTHONPATH=/code
    
    EXPOSE 5050
    
    # Set the entry point for the application
    CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050"]

By defining and registering these endpoints, the backend service should be able to handle the requests to /chat and /brains/ without returning 404 errors [1][2].

If you still encounter issues, it might be helpful to loop in a maintainer for further assistance. This is a tough nut to crack, could really use your help on this, @StanGirard.

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

Other errors now: @dosu

backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-38:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-37:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | INFO:     Waiting for child process [51]
backend-core  | INFO:     Child process [51] died
backend-core  | INFO:     Waiting for child process [63]
backend-core  | INFO:     Child process [63] died
backend-core  | INFO:     Waiting for child process [72]
backend-core  | INFO:     Child process [72] died
backend-core  | Process SpawnProcess-39:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-41:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-40:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | INFO:     Waiting for child process [75]
backend-core  | INFO:     Child process [75] died
backend-core  | INFO:     Waiting for child process [77]
backend-core  | INFO:     Child process [77] died
backend-core  | INFO:     Waiting for child process [78]
backend-core  | INFO:     Child process [78] died
backend-core  | Process SpawnProcess-44:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-43:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-42:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | INFO:     Waiting for child process [63]
backend-core  | INFO:     Child process [63] died
backend-core  | INFO:     Waiting for child process [75]
backend-core  | INFO:     Child process [75] died
backend-core  | INFO:     Waiting for child process [78]
backend-core  | INFO:     Child process [78] died
backend-core  | INFO:     Waiting for child process [85]
backend-core  | INFO:     Child process [85] died
backend-core  | Process SpawnProcess-47:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-48:
backend-core  | Process SpawnProcess-46:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
backend-core  | Process SpawnProcess-45:
backend-core  | Traceback (most recent call last):
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
backend-core  |     self.run()
backend-core  |   File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
backend-core  |     self._target(*self._args, **self._kwargs)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
backend-core  |     target(sockets=sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/supervisors/multiprocess.py", line 63, in target
backend-core  |     return self.real_target(sockets)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
backend-core  |     return asyncio.run(self.serve(sockets=sockets))
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
backend-core  |     return runner.run(main)
backend-core  |            ^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
backend-core  |     return self._loop.run_until_complete(task)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 69, in serve
backend-core  |     await self._serve(sockets)
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 76, in _serve
backend-core  |     config.load()
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 434, in load
backend-core  |     self.loaded_app = import_from_string(self.app)
backend-core  |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 22, in import_from_string
backend-core  |     raise exc from None
backend-core  |   File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 19, in import_from_string
backend-core  |     module = importlib.import_module(module_str)
backend-core  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
backend-core  |     return _bootstrap._gcd_import(name[level:], package, level)
backend-core  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
backend-core  |   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
backend-core  |   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
backend-core  |   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
backend-core  |   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
backend-core  |   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
backend-core  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
backend-core  |   File "/code/main.py", line 2, in <module>
backend-core  |     from backend.api.quivr_api.modules.chat_routes import chat_router
backend-core  | ModuleNotFoundError: No module named 'backend'
dosubot[bot] commented 2 months ago

The ModuleNotFoundError: No module named 'backend' error indicates that the backend module is not being found in the Python path. This is likely due to the way the Docker container is set up and how the Python path is configured.

Here are the steps to resolve this issue:

1. Ensure Correct Directory Structure

Make sure your project directory structure is correct and includes all necessary files:

quivr/
├── backend/
│   ├── api/
│   │   ├── quivr_api/
│   │   │   ├── modules/
│   │   │   │   ├── chat_routes.py
│   │   │   │   ├── brain_routes.py
│   │   │   └── __init__.py
│   │   └── __init__.py
│   ├── core/
│   ├── Dockerfile
│   ├── Dockerfile.dev
│   ├── poetry.lock
│   ├── poetry.toml
│   ├── pyproject.toml
│   ├── supabase/
│   ├── main.py
│   └── celery_worker.py
├── docker-compose.yml
└── other_files...

2. Update main.py

Ensure your main.py correctly imports the modules:

from fastapi import FastAPI
from backend.api.quivr_api.modules.chat_routes import chat_router
from backend.api.quivr_api.modules.brain_routes import brain_router

app = FastAPI()

app.include_router(chat_router)
app.include_router(brain_router)

@app.get("/healthz")
def read_healthz():
    return {"status": "ok"}

3. Set the PYTHONPATH Environment Variable

Ensure that the PYTHONPATH environment variable is set correctly in your Docker container. You can do this by adding it to your docker-compose.yml file or directly in the Dockerfile.

Option 1: Set PYTHONPATH in docker-compose.yml

Add the PYTHONPATH environment variable to the backend-core service in your docker-compose.yml:

version: "3.8"

services:
  backend-core:
    build:
      context: backend
      dockerfile: Dockerfile
    container_name: backend-core
    environment:
      - PYTHONPATH=/code
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      test: [ "CMD", "curl", "http://localhost:5050/healthz" ]
    command:
      - "uvicorn"
      - "main:app"
      - "--host"
      - "0.0.0.0"
      - "--port"
      - "5050"
      - "--workers"
      - "6"
    restart: always
    volumes:
      - ./backend/:/code/
    ports:
      - 5050:5050

  # Other services...

Option 2: Set PYTHONPATH in Dockerfile

Add the PYTHONPATH environment variable to your Dockerfile:

# Using a slim version for a smaller base image
FROM python:3.11.6-slim-bullseye

ARG DEV_MODE
ENV DEV_MODE=$DEV_MODE

# Install dependencies
RUN apt-get clean && apt-get update && apt-get install -y \
    libgeos-dev \
    libcurl4-openssl-dev \
    libssl-dev \
    binutils \
    pandoc \
    curl \
    git \
    poppler-utils \
    tesseract-ocr \
    autoconf \
    automake \
    build-essential \
    libtool \
    python-dev \
    wget \
    libmagic-dev \
    poppler-utils \
    tesseract-ocr \
    libreoffice \
    libpq-dev \
    gcc \
    pandoc && \
    rm -rf /var/lib/apt/lists/*

RUN ARCHITECTURE=$(uname -m) && \
    if [ "$ARCHITECTURE" = "x86_64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_amd64.deb && \
    dpkg -i supabase_1.163.6_linux_amd64.deb && \
    rm supabase_1.163.6_linux_amd64.deb; \
    elif [ "$ARCHITECTURE" = "aarch64" ]; then \
    wget https://github.com/supabase/cli/releases/download/v1.163.6/supabase_1.163.6_linux_arm64.deb && \
    dpkg -i supabase_1.163.6_linux_arm64.deb && \
    rm supabase_1.163.6_linux_arm64.deb; \
    fi && \
    rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/opt/poetry python && \
    cd /usr/local/bin && \
    ln -s /opt/poetry/bin/poetry && \
    poetry config virtualenvs.create false

# Add Rust binaries to the PATH
ENV PATH="/root/.cargo/bin:${PATH}" \
    POETRY_CACHE_DIR=/tmp/poetry_cache \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONPATH=/code

WORKDIR /code

# Copy monorepo dependencies
# CORE
COPY core/pyproject.toml core/README.md core/poetry.lock  /code/core/
COPY core/quivr_core /code/core/quivr_core
# API
COPY api/pyproject.toml  api/poetry.lock api/README.md /code/api/
COPY api/quivr_api /code/api/quivr_api

COPY ./pyproject.toml ./poetry.lock* /code/

COPY ./ci-migration.sh /code/

COPY supabase /code/supabase/

# Copy main.py and celery_worker.py
COPY main.py /code/
COPY celery_worker.py /code/

# Run install
RUN poetry install --no-root --with dev,test && \
    playwright install --with-deps && \
    rm -rf $POETRY_CACHE_DIR

EXPOSE 5050

# Set the entry point for the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "5050"]

4. Rebuild and Restart Docker Containers

After making these changes, rebuild your Docker images and restart the containers:

docker-compose down
docker-compose up --build

By ensuring the PYTHONPATH is correctly set and the directory structure is correct, the backend-core service should be able to find the backend module and start without errors [1].

If you still encounter issues, it might be helpful to loop in a maintainer for further assistance. This is a tough nut to crack, could really use your help on this, @StanGirard.

To continue talking to Dosu, mention @dosu.

sNor4pro commented 2 months ago

I don't think is gonna work, tried all what you said. Cann you give me step by step all commands with dependencies from scratch ubuntu to build Quivr? @dosu

dosubot[bot] commented 2 months ago

To build and run Quivr from scratch on a fresh Ubuntu installation, follow these detailed steps:

Step-by-Step Guide

Step 0: Install Supabase CLI

  1. Install Supabase CLI: Follow the instructions here to install the Supabase CLI.

    supabase -v # Check that the installation worked

Step 1: Install Docker and Docker Compose

  1. Update your package list:

    sudo apt-get update
  2. Install Docker:

    sudo apt-get install -y docker.io
  3. Install Docker Compose:

    sudo apt-get install -y docker-compose
  4. Start and enable Docker service:

    sudo systemctl start docker
    sudo systemctl enable docker
  5. Add your user to the Docker group (to avoid using sudo with Docker commands):

    sudo usermod -aG docker $USER
    newgrp docker

Step 2: Clone the Quivr Repository

  1. Clone the repository:

    git clone https://github.com/quivrhq/quivr.git && cd quivr

Step 3: Configure Environment Variables

  1. Copy the .env.example file to .env:

    cp .env.example .env
  2. Update the .env file:

    vim .env # or use nano, emacs, or vscode

    Update the OPENAI_API_KEY variable in the .env file. You can get your API key here.

    Want to use Ollama.ai instead? Uncomment the following lines in the .env file: OLLAMA_API_BASE_URL Run the following command to start Ollama: ollama run llama2 You can find more information about Ollama here.

Step 4: Install Additional Dependencies

  1. Install additional dependencies required for document handling:

    sudo apt-get install -y libgeos-dev libcurl4-openssl-dev libssl-dev binutils curl git autoconf automake build-essential libtool python-dev libmagic-dev poppler-utils tesseract-ocr libreoffice libpq-dev gcc pandoc

Step 5: Launch the Project

  1. Start Supabase:

    cd backend && supabase start
  2. Pull and start Docker containers:

    cd ../
    docker compose pull
    docker compose up

    If you are a developer, you can run the project in development mode with the following command:

    docker compose -f docker-compose.dev.yml up --build

Step 6: Access the Application

  1. Login to the app: You can now sign in to the app with admin@quivr.app & admin. Access the app at http://localhost:3000/login.

  2. Access Quivr backend API: http://localhost:5050/docs

  3. Access Supabase: http://localhost:54323

By following these steps, you should have Quivr up and running on your fresh Ubuntu installation. For more detailed information, you can refer to the documentation [1][2][3].

To continue talking to Dosu, mention @dosu.

saitho commented 2 months ago

I also had that issue. After running docker compose -f docker-compose.dev.yml up --build it worked...

sNor4pro commented 2 months ago

I tried this command too, but i had no luck.