diff --git a/Dockerfile b/Dockerfile index 36b321056..3d399e25a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -200,7 +200,16 @@ RUN set -eux \ '--extra-index-url https://download.pytorch.org/whl/cpu' \ 'torch==2.7.0' \ > /tmp/torch-cpu-constraints.txt \ - && uv export --quiet --no-dev --all-extras --format requirements-txt --output-file requirements.txt \ + && if [ "${TARGETARCH}" = "amd64" ]; then \ + uv export --quiet --no-dev --all-extras --no-hashes --format requirements-txt --output-file requirements.txt ; \ + else \ + uv export --quiet --no-dev --all-extras --format requirements-txt --output-file requirements.txt ; \ + fi \ + && if [ "${TARGETARCH}" = "amd64" ]; then \ + # Drop CUDA/NVIDIA-only packages that are pulled in by the CUDA PyTorch wheels on amd64. + # We'll force a CPU-only torch wheel via constraints during install, so these are unnecessary. + sed -i -E '/^(nvidia-|triton==|cusparselt==)/d' requirements.txt ; \ + fi \ && if [ "${TARGETARCH}" = "amd64" ]; then \ uv pip install --no-cache --system --no-python-downloads --python-preference system \ --index-strategy unsafe-best-match \