fix: register all nvidia pip lib dirs with ldconfig; improve GPU warnings

The static LD_LIBRARY_PATH only covered cudnn and cuda_runtime — missing
cublas, cufft, curand, cusolver, cusparse, nvjitlink, etc. onnxruntime-gpu
needs libcublasLt.so at minimum, so GPU mode silently fell back to CPU.
Replace with a one-shot ldconfig call over every nvidia site-packages lib/
dir, which covers all packages regardless of what gets installed.

Also: remove the ambiguous directory="" from preload_dlls (use auto-search
default) and add a clear warning when CUDAExecutionProvider is absent so
the user sees actionable guidance instead of silent CPU fallback.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 14:54:31 +00:00
co-authored by Claude Sonnet 4.6
parent ee585d4bae
commit 981a86f28a
2 changed files with 18 additions and 13 deletions
+5 -4
View File
@@ -72,10 +72,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY --from=build /app /app
COPY --from=build /usr/local/bin/uv /usr/local/bin/uv
# Expose CUDA/cuDNN libraries from pip packages so onnxruntime-gpu can find
# libcublasLt.so.12 and libcudnn.so.9 at runtime (amd64-gpu only).
# On cpu builds these paths don't exist; non-existent entries are ignored.
ENV LD_LIBRARY_PATH="/app/.venv/lib/python3.13/site-packages/nvidia/cudnn/lib:/app/.venv/lib/python3.13/site-packages/nvidia/cuda_runtime/lib:${LD_LIBRARY_PATH}"
# Register every nvidia pip-package lib/ directory with ldconfig so that
# onnxruntime-gpu and torch can find libcudnn, libcublas, libcufft, etc.
# without a hand-maintained LD_LIBRARY_PATH. Skipped silently on cpu builds.
RUN find /app/.venv/lib/python3.13/site-packages/nvidia -type d -name "lib" \
2>/dev/null > /etc/ld.so.conf.d/nvidia-pip.conf && ldconfig || true
RUN groupadd -g 568 apps && useradd -u 568 -g apps -m -s /bin/bash appuser \
&& mkdir -p /models/.insightface /models/huggingface \