khoj-ai / khoj

Your AI second brain. Self-hostable. Get answers from the web or your docs. Build custom agents, schedule automations, do deep research. Turn any online or local LLM into your personal, autonomous AI (e.g gpt, claude, gemini, llama, qwen, mistral).
https://khoj.dev
GNU Affero General Public License v3.0
14.09k stars 702 forks source link

Add system dependencies required by RapidOCR to fix Khoj Docker image #842

Closed kxnarak closed 4 months ago

kxnarak commented 4 months ago

Issue

The Khoj docker build would fail with ImportError: libGL.so.1: cannot open shared object file: No such file or directory. This was required by the Khoj RapidOCR python package dependency.

Stacktrace ``` khoj-server-1 | Traceback (most recent call last): khoj-server-1 | File "/app/src/khoj/main.py", line 93, in khoj-server-1 | from khoj.configure import configure_routes, initialize_server, configure_middleware khoj-server-1 | File "/app/src/khoj/configure.py", line 40, in khoj-server-1 | from khoj.routers.indexer import configure_content, configure_search khoj-server-1 | File "/app/src/khoj/routers/indexer.py", line 12, in khoj-server-1 | from khoj.processor.content.images.image_to_entries import ImageToEntries khoj-server-1 | File "/app/src/khoj/processor/content/images/image_to_entries.py", line 7, in khoj-server-1 | from rapidocr_onnxruntime import RapidOCR khoj-server-1 | File "/usr/local/lib/python3.10/dist-packages/rapidocr_onnxruntime/__init__.py", line 4, in khoj-server-1 | from .main import RapidOCR khoj-server-1 | File "/usr/local/lib/python3.10/dist-packages/rapidocr_onnxruntime/main.py", line 8, in khoj-server-1 | import cv2 khoj-server-1 | File "/usr/local/lib/python3.10/dist-packages/cv2/__init__.py", line 181, in khoj-server-1 | bootstrap() khoj-server-1 | File "/usr/local/lib/python3.10/dist-packages/cv2/__init__.py", line 153, in bootstrap khoj-server-1 | native_module = importlib.import_module("cv2") khoj-server-1 | File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module khoj-server-1 | return _bootstrap._gcd_import(name[level:], package, level) khoj-server-1 | ImportError: libGL.so.1: cannot open shared object file: No such file or directory khoj-server-1 exited with code 1 ```

Fix

A minimal set of system packages have been added to resolve this issue.

debanjum commented 4 months ago

Thanks for fixing the Khoj docker build! Verified these changes fix the LibGL system dependency missing error required by rapidOCR