Skip to content

fix(docker): install cuDNN 8 compat libraries in the CUDA Docker image - #2072

Open
basil-k-aji-dev wants to merge 1 commit into
debpalash:mainfrom
basil-k-aji-dev:fix/docker-cudnn8-compat
Open

basil-k-aji-dev wants to merge 1 commit into
debpalash:mainfrom
basil-k-aji-dev:fix/docker-cudnn8-compat

Conversation

@basil-k-aji-dev

@basil-k-aji-dev basil-k-aji-dev commented Sep 13, 2026

Copy link
Copy Markdown

Fixes #2050

The CUDA base image is pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime, so it ships cuDNN 9. CTranslate2 — WhisperX and faster-whisper — links cuDNN 8, and per the note in backend/core/cudnn8.py its absence aborts the backend process outright rather than raising (#1371).

scripts/setup.py side-loads the cuDNN 8 libraries for source installs, but the Dockerfile never did. Docker users therefore lose every CTranslate2 ASR engine, which surfaces as the demo synthesis timing out and:

WARNING [core.cudnn8] CTranslate2 ASR engines unavailable: CUDA is active but
libcudnn_ops_infer.so.8 cannot be loaded

Change

Install the same nvidia-cudnn-cu12==8.9.7.29 shim during the image build.

Two details worth flagging:

The target is derived from sys.prefix, not hardcoded. backend/core/cudnn8.py::compat_dirs() searches <sys.prefix>/lib/pythonX.Y/site-packages/cudnn8_compat/nvidia/cudnn/lib, and sys.prefix differs between the conda-based CUDA image and the ROCm venv. Deriving it keeps the install and the lookup in agreement if the base image's Python version or layout moves. I verified the computed target is exactly the parent of the directory compat_dirs() looks in.

A post-install assert fails the build if no .so.8 libraries landed. Without it, a silently empty install would reappear as this same runtime warning, which is what made the original report hard to place.

Guarded to GPU_FLAVOR=cuda — ROCm does not use cuDNN — and --no-deps keeps the install to the cuDNN wheels alone, leaving the base image's torch stack untouched, consistent with the existing torch-clobber guard directly above.

Quality gates

  • Cross-platform parity: no change to default behavior on any desktop platform; this only affects the CUDA container build, and the ROCm path is explicitly skipped.
  • Engine back-compat: additive. Already-installed engines need no reinstall or re-download — engines that were previously unusable in Docker start working.
  • i18n / DB schema / security posture: not touched, no user-facing strings, no migration, no new HTTP surface.
  • Local-first: a build-time package install from PyPI, the same mechanism as the existing uv pip install steps in this Dockerfile. No new runtime outbound calls.

Testing

docker build --check -f deploy/Dockerfile . passes — the only warning is InvalidBaseImagePlatform, because I am on arm64 and the base image is amd64.

What I could not run: I could not build the image or run uv run pytest backend/ -x -q on this machine — it is an arm64 Raspberry Pi, and the CUDA base image is amd64-only. So the install step itself is unexercised here and I would rely on CI for it. What I did verify directly is the path logic, since that is the part most likely to be wrong:

Dockerfile target : <sys.prefix>/lib/pythonX.Y/site-packages/cudnn8_compat
compat_dirs()     : <sys.prefix>/lib/pythonX.Y/site-packages/cudnn8_compat/nvidia/cudnn/lib
target is the parent of the searched lib dir: True

The pinned version matches the one scripts/setup.py already installs, so it is not a new dependency choice.

The reporter in #2050 confirmed a hardcoded variant of this fix works in a derived image; this PR generalises it and adds the verification step.

The CUDA Docker image now installs nvidia-cudnn-cu12==8.9.7.29 into the cudnn8_compat path required by CTranslate2-based WhisperX and faster-whisper engines. The install runs only for GPU_FLAVOR=cuda, uses --no-deps, and verifies that .so.8 libraries are present. Full image builds and backend tests were not run because the available machine is arm64 while the CUDA image is amd64.

The CUDA base image is pytorch/pytorch:2.8.0-cuda12.8-cudnn9-runtime, so it
ships cuDNN 9. CTranslate2 — WhisperX and faster-whisper — links cuDNN 8, and
its absence aborts the backend process outright rather than raising (debpalash#1371).

scripts/setup.py side-loads the cuDNN 8 libraries for source installs, but the
Dockerfile never did, so every CTranslate2 ASR engine was unavailable in Docker
and the demo synthesis timed out with libcudnn_ops_infer.so.8 missing.

Install the same nvidia-cudnn-cu12==8.9.7.29 shim during the image build,
deriving the target from sys.prefix so it matches where backend/core/cudnn8.py
searches rather than hardcoding the conda path — sys.prefix differs between the
conda-based CUDA image and the ROCm venv. Guarded to GPU_FLAVOR=cuda, since
ROCm does not use cuDNN, and --no-deps keeps the base image's torch stack
untouched. A post-install assert fails the build if no .so.8 libraries landed,
rather than letting it resurface as the same runtime warning.

Fixes debpalash#2050
@greptile-apps

greptile-apps Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Retrigger

The PR appears safe to merge; no blocking defect was identified.

Summary

  • Uses the interpreter-derived directory searched by the existing runtime loader.
  • Skips ROCm and fails the build if compatibility libraries are absent.
  • No actionable defects identified. Image build and GPU inference were not executed.

Reviews (1) · Last reviewed commit: "fix: install cuDNN 8 compat libraries in..."

@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 060bb062-96a4-492a-906a-7dfb06dbd6e0

📥 Commits

Reviewing files that changed from the base of the PR and between eaf8bb9 and a628ba1.

📒 Files selected for processing (1)
  • deploy/Dockerfile

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The Docker runtime stage now installs pinned cuDNN 8 compatibility libraries for CUDA images. It derives the target site-packages path and verifies the installed .so.8 files. ROCm images skip this step.

Changes

CUDA cuDNN compatibility

Layer / File(s) Summary
Runtime cuDNN installation and verification
deploy/Dockerfile
The CUDA runtime stage installs nvidia-cudnn-cu12==8.9.7.29 into cudnn8_compat without dependencies and verifies the .so.8 libraries. The ROCm variant skips the block.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: debpalash

Merge Risk: ⚪ Minimal · up to a628b

The CUDA image installs and verifies the cuDNN 8 compatibility libraries required by the affected ASR engines, with no merge-blocking issue identified.

🚥 Pre-merge checks | ✅ 8 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Local-First Guarantee ⚠️ Warning The PR adds a required outbound call to PyPI during CUDA image builds. In deploy/Dockerfile:117-120, the CUDA branch runs uv pip install ... nvidia-cudnn-cu12==8.9.7.29; no local wheel or approved… Remove the required PyPI dependency from the Docker build. Vendor the pinned cuDNN 8 wheel in an approved local build input, or copy it from an approved prebuilt image/artifact and install it with a local-only --find-links or file path. K…
✅ Passed checks (8 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #2050 requires cuDNN 8 compatibility libraries in the Docker image. deploy/Dockerfile installs nvidia-cudnn-cu12==8.9.7.29 into the sys.prefix site-packages cudnn8_compat path for `GPU_F…
Out of Scope Changes check ✅ Passed The reviewed change is limited to the cuDNN 8 compatibility installation and verification required by issue #2050. The CUDA guard and --no-deps option support the requested Docker scope and do not a…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Cross-Platform Default Parity ✅ Passed No cross-platform default-parity failure is introduced. The reviewed range changes only deploy/Dockerfile; native macOS, Windows, and Linux application defaults are unchanged. The new install runs o…
I18n Completeness (21 Locales) ✅ Passed The check is not applicable. The authoritative pull-request diff contains only deploy/Dockerfile; it contains no frontend file changes, translation-key changes, or new frontend user-facing strings.
Backward Compatibility ✅ Passed The pull request changes only deploy/Dockerfile and adds cuDNN 8 libraries under the interpreter site-packages directory with --no-deps. The /app/omnivoice_data volume, OMNIVOICE_DATA_DIR path…
Title check ✅ Passed The title uses Conventional Commit format with the required scope, accurately describes the Docker cuDNN compatibility change, and the description includes issue reference #2050.
Description check ✅ Passed The description clearly explains the issue, implementation, scope, testing, and known testing limitation. It does not reproduce the template's Type and Checklist sections, but the missing sections are…
Full details: Local-First Guarantee

Explanation

The PR adds a required outbound call to PyPI during CUDA image builds. In deploy/Dockerfile:117-120, the CUDA branch runs uv pip install ... nvidia-cudnn-cu12==8.9.7.29; no local wheel or approved index is supplied, so a CUDA image build depends on the PyPI service. The diff adds no runtime telemetry, account, or API-key behavior, but the custom check permits outbound traffic only to GitHub Issues and HuggingFace model downloads.

Resolution

Remove the required PyPI dependency from the Docker build. Vendor the pinned cuDNN 8 wheel in an approved local build input, or copy it from an approved prebuilt image/artifact and install it with a local-only --find-links or file path. Keep the post-install library assertion so the build fails when the local artifact is missing.

  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@basil-k-aji-dev basil-k-aji-dev changed the title fix: install cuDNN 8 compat libraries in the CUDA Docker image fix(docker): install cuDNN 8 compat libraries in the CUDA Docker image Sep 13, 2026
@basil-k-aji-dev

Copy link
Copy Markdown
Author

Thanks — title updated to fix(docker): ....

On the local-first warning, I think it is being applied to the wrong layer, but I would rather lay out the reasoning than quietly dismiss it.

The gate in CONTRIBUTING reads:

Local-first: no new outbound calls except GitHub Issues (opt-in reporting) and HuggingFace model downloads. Never log or persist secrets or absolute home paths.

That sits among runtime properties — logging, persisted secrets, home paths — so I read it as constraining what the running application does on a user's machine, not what the image build fetches. This change adds nothing at runtime; it only puts files into the image.

At build time the Dockerfile already reaches the network in four places:

  • deploy/Dockerfile:20bun install --frozen-lockfile (npm registry)
  • deploy/Dockerfile:48apt-get install (Debian archives)
  • deploy/Dockerfile:64python3 -m pip install uv (PyPI)
  • deploy/Dockerfile:90uv pip install --constraint deploy/torch-constraints.txt . (PyPI)

My line 119 is the same mechanism as 64 and 90, pinned to the exact version scripts/setup.py already installs, so it is not a new outbound channel or a new dependency decision — it is the step that was missing relative to the source install.

Vendoring the wheel as the bot suggests would mean carrying ~700 MB of platform-specific CUDA binaries in-tree, which seems a worse trade than one pinned install alongside the four that already run.

Happy to be overruled — if you would prefer it vendored, sourced from a prebuilt artifact, or made opt-in behind a build arg, say which and I will rework it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Install] No cudnn8_compat present in Docker image

1 participant