policy package_management ai_generated true

pip install succeeds for a yanked PyPI package version that was supposed to be removed

ID: policy/pypi-yanked-package-still-installable

Also available as: JSON · Markdown
82%Fix Rate
85%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active — — —

Root Cause

PyPI yank does NOT delete the package. It only hides it from resolution UNLESS the version is pinned exactly in requirements. 'pip install pkg==1.2.3' still installs yanked 1.2.3. Only 'pip install pkg' (unpinned) skips yanked versions.

generic

Workarounds

  1. 92% success Publish a post-release or patch version with the fix, then yank the bad version
    Upload pkg==1.2.4 with fix, then yank 1.2.3. Users upgrading get 1.2.4. Existing pins still get 1.2.3 (with pip warning).
  2. 85% success Use pip --no-yanked flag or check pip warnings for yanked package notices
    pip warns on yanked installs since pip 20.0. CI should treat pip warnings as errors: pip install --strict
  3. 78% success For critical security issues, file a PyPI deletion request (not just yank)
    Contact PyPI support for complete deletion of malicious packages. Yank is insufficient for malware.

Dead Ends

Common approaches that don't work:

  1. Yank a package version expecting it to be completely unavailable 88% fail

    Yanking is a soft-delete. Exact version pins (==) still install yanked versions. Lock files with pinned versions continue to work.

  2. Rely on yanking to remove a security vulnerability from circulation 85% fail

    All existing requirements.txt files with pinned versions will continue to install the yanked version. You need to publish a new patched version.