Repository navigation
fix(docker): install CPU-only torch before easyocr - #433
Open
thakur-patel wants to merge 3 commits into
Open
thakur-patel wants to merge 3 commits into
thakur-patel wants to merge 3 commits into
Conversation
easyocr transitively depends on torch, and PyPI's default Linux torch wheel bundles the full CUDA toolkit as separate nvidia-* packages (cuBLAS, cuSOLVER, cuDNN, NCCL, etc). These images only ever run OCR on CPU, so the CUDA build adds several unused GB and was large enough to fill a build host's disk mid-export. Installing the CPU-only wheel from download.pytorch.org first keeps pip/uv from ever resolving the CUDA variant.
Mirror the Conventional Commit types the commit-msg hook already enforces (fix/feat/refactor/docs/chore/test/perf/style/build/ci) so branch names carry the same signal as commit prefixes.
Recommend tagging images <optics_version>-<vision_backend> (e.g. 1.9.1-easyocr) across all four build paths so the tag itself states what's baked into the image, instead of leaving both facts to guesswork after the fact.
|
thakur-patel
marked this pull request as ready for review
August 4, 2026 14:49
malto101
approved these changes
Aug 31, 2026
Member
|
seems to have diverge, @thakur-patel could you rebase from main tip |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
easyocrtransitively depends ontorch, and PyPI's default Linuxtorchwheel bundles the full CUDA toolkit as separatenvidia-*packages (cuBLAS, cuSOLVER, cuDNN, NCCL, etc). These containers only run OCR on CPU, so that's several unused GB — large enough that it filled a build host's disk mid-image-export during a real build attempt.torch/torchvisionwheel fromdownload.pytorch.org/whl/cpubeforeeasyocrinDocker/prod/Dockerfile,Docker/mcp/prod/Dockerfile, andDocker/dev/Dockerfile, so pip/uv never resolves the CUDA variant.CLAUDE.md(fix/,feat/,refactor/, etc.) mirroring the Conventional Commit types already enforced by the commit-msg hook.Docker/deployment.md: tag images<optics_version>-<vision_backend>(e.g.1.9.1-easyocr) across all four build paths, so the tag itself states what's baked into the image.Why
A production image build from a disk-constrained host (Cloud Shell, 95G root) failed with
no space left on deviceduring image export. Root cause traced to the CUDA-enabledtorchwheel pulled in transitively byeasyocr— none of the CUDA libraries are used since these images run inference on CPU only.Test plan
Docker/prod/Dockerfilelocally (VISION_BACKEND=easyocr, the default) and confirmed the image builds without pulling anynvidia-*CUDA packages (torch==2.13.0+cpu,torchvision==0.28.0+cpu), and thateasyocr.Reader(['en'])still initializes fine on CPU torch.Docker/mcp/prod/DockerfileandDocker/dev/Dockerfile.