Skip to content

Vendored Pipenv lock breaks pipenv requirements --hash | pip install -r on Pipenv 2023+: the vendored wheel is exported without a hash, so pip's hash-checking mode refuses the whole install #981

Description

[agent] Found by the scheduled Pipenv bug-hunt routine (ledger #313).

Summary

After a vendored scan, Pipfile.lock points the package at ./.socket/vendor/pypi/<uuid>/<wheel> with a hashes list. Pipenv 2023 and later never print hashes for file / path entries when exporting (pipenv/utils/dependencies.py requirement_from_lockfile, the for k in ["file", "path"] branch). So pipenv requirements --hash writes every registry package with --hash= and the vendored wheel without one. pip turns on --require-hashes as soon as any line carries a hash, and then refuses the whole install:

ERROR: Hashes are required in --require-hashes mode, but they are missing from some requirements.
    file:///…/proj/.socket/vendor/pypi/7b8c9d0e-…/six-1.16.0-py2.py3-none-any.whl --hash=sha256:6025c3…

The same project installs fine from the pristine lock, and from the hosted lock (the hosted file URL carries a #sha256= fragment, which pip accepts as the hash). Pipenv 2022.12.19 exports file:///<abs> --hash=… and works.

Impact

pipenv requirements --hash > requirements.txt && pip install -r requirements.txt is a common way to build Docker images from a Pipenv project. After switching to vendored mode, that build fails, and it fails for every package rather than just the patched one. Nothing warns about it. The only vendored warning, vendor_integrity_unverified, is about Pipenv not checking the hash at install time. Meanwhile docs/testing/pipenv-compatibility.md:79 lists pipenv requirements as supported ("it exports the hosted URL / vendored path").

I didn't find a lock shape that avoids this. Appending #sha256=<hex> to the relative file path (as hosted does for its URL) makes pipenv sync fail and pip reject the line as a nonexistent path. So the fix is probably a documented limitation plus a warning, for example in the vendored Pipenv warnings or the takeover output, pointing at hosted mode or plain pipenv requirements without --hash. A real export fix would be better if one exists.

Repro (Linux, Pipenv 2026.8.0, py3.12)

mkdir proj && cd proj
cat > Pipfile <<'EOF'
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
six = "==1.16.0"
idna = "==3.7"
EOF
PIPENV_VENV_IN_PROJECT=1 pipenv install && rm -rf .venv
socket-patch scan --json --yes --vendor --vendor-source service --cwd .   # six has a patch; exit 0
pipenv requirements --hash > /tmp/req.txt
#   idna==3.7; … --hash=sha256:028f… --hash=sha256:82fe…
#   ./.socket/vendor/pypi/<uuid>/six-1.16.0-py2.py3-none-any.whl ; python_version >= '2.7' …   (no hash)
python3.12 -m venv /tmp/pv && /tmp/pv/bin/pip install --no-deps -r /tmp/req.txt
#   ERROR: Hashes are required in --require-hashes mode … exit 1; nothing installed

The control is the same commands with --mode=hosted instead of --vendor …: pip exits 0 and installs the patched six. I ran it against a local mock patch API that serves a patched copy of the real six-1.16.0 wheel, the same shape as crates/socket-patch-cli/tests/vex_pipenv_pip_real.

Expected vs actual

  • Expected: a vendored Pipfile.lock stays usable through Pipenv's documented export (pipenv-compatibility.md:79). If Pipenv makes that impossible, it's a documented limitation that the CLI warns about, the way vendor_integrity_unverified and pypi_pipenv_stale_install cover Pipenv's other gaps.
  • Actual: exit 0 and no warning, and the next pip install -r of the exported file fails outright.

Matrix (Linux, main 9c43dfc)

Pipenv vendored + requirements --hash → pip install -r hosted (control) pristine lock (control)
2022.12.19 (py3.8) pass (exports file:///<abs> --hash=…) – pass
2023.12.1 (py3.12) fail (2/2) – pass
2024.4.1 (py3.12) fail – pass
2026.8.0 (py3.12) fail (2/2) pass pass

Plain pipenv requirements (no --hash) works on all of these, as long as no other line carries a hash. I didn't bisect the exact 2023.x release where the hash was dropped. macOS and Windows are untested: the export logic is pure Python, so I'd expect the same result there.

Suspect location

  • crates/socket-patch-core/src/vendor/pypi_pipenv.rs:144: the only vendored Pipenv advisory (vendor_integrity_unverified) doesn't mention the export gap.
  • docs/testing/pipenv-compatibility.md:79 and the Pipenv cell in docs/ecosystems.md:18: they don't document it.

Backlog review — 2026-10-08

Priority: P1 → P2. Pipenv hash export breaks the pip installation explicitly; hashes are not silently bypassed.

Activity

  1. added a commit that references this issue on Oct 7, 2026
  2. mikolalysenko commented on Oct 7, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Triaged as priority:p1 (Pipenv). Confirmed on main 9c43dfc: the only vendored Pipenv advisory is vendor_integrity_unverified (crates/socket-patch-core/src/vendor/pypi_pipenv.rs:145), and docs/testing/pipenv-compatibility.md:79 still lists pipenv requirements as supported with no --hash caveat. I found no duplicate and no open PR for this. #612 is also about vendored Pipenv, but its cause is different (a sibling requirements.txt that never gets wired), so I haven't clustered them.


    Generated by Claude Code

  3. mikolalysenko commented on Oct 7, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Bisect from the Pipenv bug-hunt routine (ledger #313), on main 9c43dfc (unchanged). I took one vendored lock (six 1.16.0 + idna) and ran pipenv requirements --hash with each release:

    Pipenv exported vendored line
    2022.12.19, 2023.2.4, 2023.3.20, 2023.4.29, 2023.6.12, 2023.6.18 file:///<abs>/…whl ; <markers> --hash=sha256:… (OK)
    2023.6.26 file:///<abs>/…whl --hash=sha256:… (markers dropped, OK)
    2023.7.1, 2023.7.3, 2023.7.4 six== --hash=sha256:… (Pipenv's own exporter bug for any file entry; pip fails loudly, No matching distribution found for six==)
    2023.7.9 and later (2023.7.11, 2023.7.23, 2023.9.8, 2023.10.24, 2023.12.1, 2026.8.0) ./.socket/vendor/…whl ; <markers> with no hash (this issue)
    • First bad release: Pipenv 2023.7.9. On every release from then on the vendored line has no --hash.
    • --dev, --dev-only and --categories docs exports behave the same way (checked on 2023.12.1 and 2026.8.0, with six vendored in develop and [docs]).
    • pipenv sync of the vendored lock on 2023.6.26, 2023.7.1, 2023.7.4 and 2023.7.9 installs the patched wheel, so only the requirements export is affected.

    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions