voice: torchcodec needs NVIDIA NPP, and needs to be able to find it

Voice cloning failed with 'Could not load libtorchcodec', whose message blames
FFmpeg and the torch version. It was neither: the CUDA build links against
NVIDIA Performance Primitives (libnppicc.so.12), torch does not use NPP, and
torchcodec arrives as a transitive dependency of f5-tts — so nothing ever
installed it.

Installing it is only half: torch preloads its own nvidia libs and NPP is not
among them, so the library sits in site-packages and the loader never looks
there. LD_LIBRARY_PATH covers the other half.

Verified in the built image: torch 2.11.0+cu128, torchcodec 0.11.1+cu128,
AudioDecoder imports. Two wrong theories preceded this — an FFmpeg major
mismatch and a torch/torchcodec ABI mismatch — both suggested by that error
message, and both disproved by loading each .so by hand with torch imported.
Co-Authored-By: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0182DhR1eFNPQyGmDrpHbedY
parent 2f82630c
...@@ -28,6 +28,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ...@@ -28,6 +28,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg git curl ca-certificates libgl1 libglib2.0-0 \ ffmpeg git curl ca-certificates libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Installing NPP is not enough: torch preloads its own nvidia libs and NPP is
# not among them, so nothing adds this directory to the loader's search path and
# libnppicc.so.12 stays invisible. Both halves are needed.
ENV LD_LIBRARY_PATH=/usr/local/lib/python3.12/site-packages/nvidia/npp/lib:${LD_LIBRARY_PATH}
WORKDIR /opt/coderai/app WORKDIR /opt/coderai/app
# torch and the import-time requirements every capability needs. A BuildKit cache # torch and the import-time requirements every capability needs. A BuildKit cache
......
...@@ -39,3 +39,9 @@ websockets>=12.0 ...@@ -39,3 +39,9 @@ websockets>=12.0
# bitsandbytes" after a 10-minute SDXL download. Shared here rather than per # bitsandbytes" after a 10-minute SDXL download. Shared here rather than per
# profile: one layer, downloaded once, reused by all ten images. # profile: one layer, downloaded once, reused by all ten images.
bitsandbytes>=0.43.0 bitsandbytes>=0.43.0
# torchcodec's CUDA build links against NVIDIA Performance Primitives
# (libnppicc.so.12). torch does not use NPP, so nothing else pulls it in, and
# torchcodec — which arrives as a transitive dependency of f5-tts — then fails
# to load with a message that blames FFmpeg and the torch version. It is neither.
nvidia-npp-cu12
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment