python data_error ai_generated true

ERROR: Wheel 'numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.whl' is invalid: error in <pkg> METADATA: invalid zip file

ID: python/pip-cache-corruption-invalid-wheel

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-11-21First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

A previously downloaded wheel in the pip cache is truncated or corrupted, and pip reuses it without re-validating the zip structure.

generic

中文

pip 缓存中先前下载的 wheel 被截断或损坏,pip 复用时未重新校验 zip 结构。

Workarounds

  1. 95% success
    Purge the cache and reinstall: `pip cache purge && pip install --no-cache-dir <pkg>`.
  2. 92% success
    Inspect and remove the specific cached wheel: `pip cache list <pkg>` then `pip cache remove <pkg>`.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Disables index lookup entirely, so pip cannot refetch the corrupted wheel.

  2. 70% fail

    Force-reinstall still consults the cache and can reuse the same corrupted file.