diff --git a/AGENTS.md b/AGENTS.md index fae2888d..c80b69c7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -33,6 +33,8 @@ uv pip install -r application/requirements.txt # or: pip install -r application # uv pip install -r application/requirements-docling.txt # docling parser engine (OCR backend, structured output) # uv pip install -r application/requirements-milvus.txt # VECTOR_STORE=milvus # With uv alone: `uv sync --extra docling` (pyproject.toml + uv.lock are the source of truth). +# `uv pip install -r application/requirements-docling.txt` needs UV_INDEX_STRATEGY=unsafe-best-match +# (the file adds the PyTorch CPU index; prefer `uv sync --extra docling`). ``` Dependencies are declared in `pyproject.toml` and locked in `uv.lock`; the diff --git a/application/Dockerfile b/application/Dockerfile index 9caa2720..5e9fdd57 100644 --- a/application/Dockerfile +++ b/application/Dockerfile @@ -136,7 +136,10 @@ RUN if python -c "import docling" 2>/dev/null; then \ COPY --chown=appuser:appuser . /app/application -RUN mkdir -p /app/application/inputs/local +# Runtime data directories, owned by the process user so a named volume +# mounted on them (docker-compose-standalone.yaml) inherits that ownership +# and uploads work without running the container as root. +RUN mkdir -p /app/application/inputs/local /app/inputs /app/indexes /app/vectors ENV FLASK_APP=app.py diff --git a/application/requirements-docling.txt b/application/requirements-docling.txt index 5e3822ad..a7654fad 100644 --- a/application/requirements-docling.txt +++ b/application/requirements-docling.txt @@ -8,6 +8,10 @@ # through application/parser/file/ocr_parser.py. # On Linux torch comes from the CPU-only PyTorch index (no CUDA stack); a GPU # deployment can reinstall torch from PyPI on top. +# pip resolves the extra index as expected. uv only takes a package from the +# first index that lists it, and the PyTorch index carries stale copies of +# common packages, so with uv either run 'uv sync --extra docling' (the lock +# pins the index per package) or set UV_INDEX_STRATEGY=unsafe-best-match. # Docker: --build-arg EXTRAS=docling --extra-index-url https://download.pytorch.org/whl/cpu diff --git a/deployment/docker-compose-standalone.yaml b/deployment/docker-compose-standalone.yaml index 14bc3135..937de312 100644 --- a/deployment/docker-compose-standalone.yaml +++ b/deployment/docker-compose-standalone.yaml @@ -32,6 +32,10 @@ services: backend: image: arc53/docsgpt:${DOCSGPT_IMAGE_TAG:-latest}${DOCSGPT_IMAGE_VARIANT:-} + # Same as docker-compose-hub.yaml: the data volumes are written by root so + # any image tag works, including releases that predate the appuser-owned + # /app/inputs, /app/indexes and /app/vectors directories. + user: root env_file: - path: .env required: false @@ -55,6 +59,7 @@ services: worker: image: arc53/docsgpt:${DOCSGPT_IMAGE_TAG:-latest}${DOCSGPT_IMAGE_VARIANT:-} + user: root # Consumes the default queue plus `parsing` (read_document) and `embeddings` # (query embedding); without the latter every search times out. command: celery -A application.app.celery worker -l INFO -B -Q docsgpt,parsing,embeddings diff --git a/docs/content/Deploying/Development-Environment.mdx b/docs/content/Deploying/Development-Environment.mdx index f1b90d12..895b3fcb 100644 --- a/docs/content/Deploying/Development-Environment.mdx +++ b/docs/content/Deploying/Development-Environment.mdx @@ -108,6 +108,10 @@ To run the DocsGPT backend locally, you'll need to set up a Python environment a # or with uv: uv sync --extra docling --extra milvus ``` + The docling file adds the PyTorch CPU index; pip handles that as-is, while + `uv pip install -r` needs `UV_INDEX_STRATEGY=unsafe-best-match` (or use + `uv sync --extra docling`, which reads the lock). + A feature whose extra is missing fails with the exact command to run. After changing `pyproject.toml`, run `uv lock` and `bash scripts/export_requirements.sh` so the exported files stay in sync diff --git a/scripts/export_requirements.sh b/scripts/export_requirements.sh index effae6ee..e86edd22 100755 --- a/scripts/export_requirements.sh +++ b/scripts/export_requirements.sh @@ -54,6 +54,10 @@ OCR_ENABLED=true with the tesseract binary (or a DeepSeek-OCR endpoint) runs through application/parser/file/ocr_parser.py. On Linux torch comes from the CPU-only PyTorch index (no CUDA stack); a GPU deployment can reinstall torch from PyPI on top. +pip resolves the extra index as expected. uv only takes a package from the +first index that lists it, and the PyTorch index carries stale copies of +common packages, so with uv either run 'uv sync --extra docling' (the lock +pins the index per package) or set UV_INDEX_STRATEGY=unsafe-best-match. Docker: --build-arg EXTRAS=docling" \ --extra docling