# Reference only — dependencies are installed directly in the Dockerfile # to allow layered pip caching. See Dockerfile for the authoritative install order. # # ── Layer 1 — FastAPI + lightweight runtime deps ────────────────────────────── fastapi>=0.115.0 uvicorn[standard]>=0.32.0 python-multipart>=0.0.12 Pillow>=10.0.0 pillow-heif>=0.18.0 huggingface_hub>=0.25.0 opencv-python-headless>=4.8.0 # placeholder; force-reinstalled in Layer 4 # # ── Layer 2 — CPU-only PyTorch ──────────────────────────────────────────────── # pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision # MUST come before magic-pdf. PyPI serves the CUDA wheel by default (~2.5 GB). # Pre-installing the CPU build causes pip to skip the CUDA wheel when resolving # magic-pdf's `torch` requirement. torch>=2.2.2,!=2.5.0,!=2.5.1,<3 torchvision>=0.15.2 # # ── Layer 3 — magic-pdf with CORRECT extras ─────────────────────────────────── # pip install --extra-index-url https://myhloli.github.io/wheels/ magic-pdf[full]==1.3.12 # # FORENSIC SUMMARY: # # [full-cpu] is NOT a valid extra in magic-pdf 1.3.12. # Valid extras: [full], [full_old_linux], [lite] # Using an invalid extra causes pip to install base-only — omitting # ultralytics, doclayout-yolo, rapid-table, and OCR support entirely. # # [full] provides: # ultralytics >=8.3.48 YOLO framework, required by doclayout-yolo # doclayout-yolo ==0.0.2b1 layout detection (myhloli index only) # rapid-table >=1.0.5 table detection (onnxruntime pulled as transitive dep) # shapely, pyclipper used by paddleocr2pytorch (baked into magic-pdf wheel) # omegaconf, matplotlib, ftfy, dill, PyYAML, openai, albumentations # # [lite] is NOT used because: # - paddlepaddle==3.0.0b1 pinned by [lite] does not exist on PyPI (removed beta) # - paddleocr==2.7.3 requires opencv-python <=4.6.0.66, incompatible with # ultralytics (>=4.6.0) and doclayout-yolo (>=4.6.0) # - paddlepaddle/paddleocr are NOT needed: pipeline backend uses paddleocr2pytorch, # a self-contained PyTorch reimplementation bundled inside the magic-pdf wheel # # --extra-index-url https://myhloli.github.io/wheels/ is required because # doclayout-yolo==0.0.2b1 is only on the myhloli wheel server, not on PyPI. magic-pdf[full]==1.3.12 # # ── Layer 4 — Restore headless OpenCV (MUST be last) ───────────────────────── # pip install --force-reinstall opencv-python-headless>=4.8.0 # Layer 3 installs opencv-python (non-headless) via doclayout-yolo + ultralytics # + rapid-table transitive deps. Force-reinstalling headless overwrites cv2 with # the build that works on this container without X11 libs. opencv-python-headless>=4.8.0 # force-reinstalled in Layer 4