Skip to content

fix(docker): restore libcudnn.so.9 in :cuda image - #18

Merged
oldhero5 merged 1 commit into
mainfrom
fix/cuda-cudnn-install
May 25, 2026
Merged

fix(docker): restore libcudnn.so.9 in :cuda image#18
oldhero5 merged 1 commit into
mainfrom
fix/cuda-cudnn-install

Conversation

@oldhero5

Copy link
Copy Markdown
Owner

Summary

The published `oldhero5/waldo:main-cuda` image fails on `import torch` with `ImportError: libcudnn.so.9: cannot open shared object file`. Verified locally on this branch: now imports cleanly, torch sees the GPU, GPU matmul runs.

Root cause

`Dockerfile.cuda` had two `uv sync` steps with a `uv pip install ... torch torchvision` between them. The second `uv sync` reconciled against the lockfile, saw `nvidia-cudnn-cu13` dist-info already present (from the cu130 torch install), and stripped `libcudnn.so.9` off disk while keeping the dist-info shell. `torch._C` then failed to load at import time.

Fix

  1. Pin the cu130 index URL explicitly (was `cu124` — uv was silently falling through to cu130 since cu124 maxes out at torch 2.6 and our pyproject pins `torch>=2.5`).
  2. Replace the second `uv sync` with `uv pip install --no-deps -e .`. We only need to drop the project itself into the venv at that point; the cuda deps are already correctly laid down by the prior step.

Test plan

  • `oldhero5/waldo:main-cuda` reproduces the failure: `ImportError: libcudnn.so.9`
  • Local build of this branch: `libcudnn.so.9` present in `/app/.venv/.../nvidia/cudnn/lib/`
  • `import torch`; `torch.cuda.is_available()` returns `True`
  • 2048×2048 matmul on `cuda:0` succeeds, RTX 5000 Ada visible
  • Full nvidia profile stack boots: `/health` returns 200, both `waldo-labeler-nvidia` and `waldo-trainer-nvidia` report `CUDA available: True` at startup
  • Image size unchanged (13.6 GB local)
  • CI `test` workflow passes
  • CI `release` workflow republishes `:main-cuda` cleanly

Unblocks #8 (devel→runtime base swap), which can now land as a one-line follow-up.

Closes #17.

🤖 Generated with Claude Code

The published :main-cuda image fails on `import torch` because the second
`uv sync` (project-install pass) reconciles against the lockfile, sees
nvidia-cudnn-cu13 dist-info already present from the cu130 torch install,
and silently strips libcudnn.so.9 off disk while keeping the dist-info
shell — leaving torch's _C extension unable to load.

Two surgical changes to Dockerfile.cuda:

1. Pin the cu130 install URL explicitly (was cu124, which was masking a
   silent fallback to cu130) and add --extra-index-url for non-torch
   transitives.
2. Replace the second `uv sync` (which was the only step that could
   un-install nvidia-cudnn) with `uv pip install --no-deps -e .`. We
   only need the project itself in the venv at that point; deps are
   already correctly laid down by step 1 + the cu130 install.

Verified end-to-end on this machine:
- libcudnn.so.9 is present at /app/.venv/lib/python3.11/site-packages/nvidia/cudnn/lib/
- `import torch` succeeds; torch.cuda.is_available() is True
- GPU matmul (2048x2048) runs on RTX 5000 Ada, cuda:0
- Full nvidia profile stack boots cleanly: app /health=200, labeler+trainer
  workers report `CUDA available: True` with the GPU visible

Image size unchanged at 13.6 GB local; PR #8 (devel→runtime base) can
land on top of this.

Closes #17.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@oldhero5
oldhero5 merged commit ce87365 into main May 25, 2026
1 check passed
@oldhero5
oldhero5 deleted the fix/cuda-cudnn-install branch May 25, 2026 10:34
oldhero5 added a commit that referenced this pull request May 25, 2026
Cuts the local image from 13.6 GB to 8.69 GB (~36% / 4.9 GB saved). The
published compressed size will drop accordingly. We ship prebuilt CUDA
torch wheels and never invoke nvcc, so the devel base's CUDA SDK was
pure dead weight.

Verified locally on this machine (RTX 5000 Ada):
- Image builds clean
- `import torch` succeeds; torch.cuda.is_available() is True
- 2048x2048 matmul on cuda:0 works (no JIT/nvcc requirement surfaced)

Builds on top of #18 which fixed the underlying libcudnn install — this
is now just the one-line base swap the issue scoped.

Closes #8.

Co-authored-by: oldhero5 <oldhero5@proton.me>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

Bug: published :cuda image has broken cudnn install (libcudnn.so.9 missing)

1 participant