logoalt Hacker News

aftbit • yesterday at 4:52 PM • 2 replies • view on HN

Or - you can just upgrade pip with a SHA hash pin, or set the magic env vars to use the system bundle.

You do need to be careful about creating new venvs with the old version of pip bundled in ensurepip in older Python releases. `uv` kindly patches that to newest pip, but not every Python binary does.

  python -m pip install "pip @ https://files.pythonhosted.org/packages/3f/06/3e4420302363fbb71be3c7f35ce042f54bfca330e3e66b3a2e3c4cca579f/pip-26.2.2-py3-none-any.whl#sha256=fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70"
Or alternatively, on Debian with fixed system cert chain:

  PIP_USE_DEPRECATED=legacy-certs PIP_CERT=/etc/ssl/certs/ca-certificates.crt python -m pip install --upgrade "pip>=26.2.2"

https://discuss.python.org/t/avoiding-compromised-certificat...

Replies

zahlman • today at 5:47 AM

I had a pretty fun time with it myself. Rather than a system package for pip, or the `ensurepip`-provided one, I've been using the copy managed by pipx. I had to:

* Update system certificates

* Locate that pip and directly invoke it to self-update with hash pinning, rather than going through pipx

* Fix a few stray venvs that contained their own pip

* Use the fixed pipx to update uv (although I guess the uv self-update should work even for a pipx-installed copy?)

The legacy-certs hint is neat. I did it the first way but would rather not have since I'm on Mint.

tetha • yesterday at 7:17 PM

Good to know. Does the first invocation recompute and check the hash of the wheel locally afterwards to ensure integrity?

➕ show 1 reply