Spaces:
Running
fix: use --extra-index-url so pip can resolve torch's build deps
Browse filesThe build failed at the PyTorch pip step with:
ERROR: No matching distribution found for flit_core<4,>=3.11
Root cause: the PyTorch index lists the package as "typing-extensions"
while the wheel metadata declares "typing_extensions". Modern pip rejects
that name mismatch, discards the wheel, and falls back to a source build,
which needs flit_core — but --index-url had replaced PyPI, and the PyTorch
index carries neither flit_core nor most of torch's other deps.
--extra-index-url keeps PyPI primary so both the correctly-named wheel and
flit_core resolve. Pinned torch to 2.5.1+cpu (matching the version the
models were trained with) and the +cpu local version keeps the 196MB CPU
wheel rather than PyPI's 555MB CUDA build.
Previous builds passed only because the layer was cached; the cache went
cold on this export and exposed the latent problem.
- Dockerfile +8 -2
|
@@ -41,10 +41,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 41 |
RUN npm install -g tsx
|
| 42 |
|
| 43 |
# --- Python ML deps (CPU-only PyTorch + TensorFlow) ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
RUN pip install --no-cache-dir --break-system-packages \
|
| 45 |
"numpy>=1.26.0,<2.0.0" \
|
| 46 |
-
torch torchvision \
|
| 47 |
-
--index-url https://download.pytorch.org/whl/cpu
|
| 48 |
|
| 49 |
RUN pip install --no-cache-dir --break-system-packages \
|
| 50 |
"numpy>=1.26.0,<2.0.0" \
|
|
|
|
| 41 |
RUN npm install -g tsx
|
| 42 |
|
| 43 |
# --- Python ML deps (CPU-only PyTorch + TensorFlow) ---
|
| 44 |
+
# Must be --extra-index-url, not --index-url. The PyTorch index lists the package
|
| 45 |
+
# as "typing-extensions" while the wheel metadata says "typing_extensions"; modern
|
| 46 |
+
# pip rejects that mismatch, discards the wheel, and falls back to a source build
|
| 47 |
+
# that needs flit_core — which --index-url had removed PyPI as a source for.
|
| 48 |
+
# Keeping PyPI primary supplies flit_core and the correctly-named wheel.
|
| 49 |
+
# The +cpu local version keeps the 196MB CPU build instead of PyPI's 555MB CUDA one.
|
| 50 |
RUN pip install --no-cache-dir --break-system-packages \
|
| 51 |
"numpy>=1.26.0,<2.0.0" \
|
| 52 |
+
"torch==2.5.1+cpu" "torchvision==0.20.1+cpu" \
|
| 53 |
+
--extra-index-url https://download.pytorch.org/whl/cpu
|
| 54 |
|
| 55 |
RUN pip install --no-cache-dir --break-system-packages \
|
| 56 |
"numpy>=1.26.0,<2.0.0" \
|