-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package hash mismatch with custom pypi under 2023.8.19 and later #5848
Comments
This seems noteworthy: Digging through the pipenv 2023.8.21 source and adding some logging to understand how it works, I noticed that What was actually being hashed by Removing
Did something change between 2023.7.23 and 2023.8.19 regarding downloading of packages? Maybe the previous implementation was omitting |
I've had this issue, my pypi has tokens in its URL, the index url is With the previous version I tried to generate an URL relative to the root |
Oh wow ... 🤦♂️ Some backstory here -- I originally added the code path to start checking private pypis to speed up locking -- and this will be a big deal with something like pytorch once the work backing pytorch/builder#1433 gets completed because instead of downloading 8x 3.5 GB wheels to get the hashes, it will just get them from the index URLs. That being said, clearly I introduced some edge cases that I didn't foresee. Totally open to PRs to help clean those up, I can guarantee I won't be able to look at this immediately.
This also surprises me, but seems possible -- from my perspective of what I was seeing in my testing that lead to me changing that is we were calling to get the hash with just the trailing /simple/uri.whatever without the root domain of the test pypi server so it wasn't gathering the hashes correctly in my test example. 🤦 🤦 Sounds like there are a couple things to sort out here:
|
I think I got to the bottom of this issue (I hope for all cases), could you check out if #5866 resolves the issue for your case? |
Thank you! I’ll give the patch a run through today and report back. |
Success! The change works great, and so does release 2023.8.25. Thank you for resolving this! |
Issue description
Installing a package from a custom pypi registry with pipenv 2023.8.19 or later results in a hash mismatch:
I do not have reason to believe the packages have been tampered with, and the packages have not been changed, updated, or republished for well over a year.
Most telling, reverting to pipenv 2023.7.23 fixes the issue. The issue occurs under pipenv 2023.8.19, 2023.8.20, and 2023.8.21.
Expected result
I expected the custom pypi package to install without a hash mismatch.
Actual result
The above error message.
Steps to replicate
Publish a package on a custom/non-pypi registry
Create a
Pipfile
referencing the package:Run
pipenv install --dev
to lock dependencies and write out Pipfile.lockAfter successfully writing out Pipfile.lock, pipenv errors as above
It's unclear to me where pipenv is getting the "Expected" hashes from when there was not a Pipfile.lock on disk until pipenv created it, after which it immediately disagrees with itself about what the hash ought to be. It seems as if the logic that writes Pipfile.lock is doing something incorrectly, and the system that verifies the actual hash is working correctly; For comparison's sake, if I fetch the redactedpackagename archive from mycompanypypi and sha256 it myself, I get the 93ac... hash that pipenv "Got".
Of note:
arrow
from pypi), everything succeeds.(I've modified this support info a little to redact some company-specific things, but I don't think I've done it in a way that compromises its purpose.)
$ pipenv --support
Pipenv version:
'2023.8.21'
Pipenv location:
'/Users/callen/.pyenv/versions/3.11.3/lib/python3.11/site-packages/pipenv'
Python location:
'/Users/callen/.pyenv/versions/3.11.3/bin/python3.11'
OS Name:
'posix'
User pip version:
'23.2.1'
user Python installations found:
PEP 508 Information:
System environment variables:
SHELL
LSCOLORS
PYENV_HOOK_PATH
PIPENV_VENV_IN_PROJECT
PYENV_SHELL
LESS
XPC_FLAGS
HISTCONTROL
TERM_PROGRAM_VERSION
__CFBundleIdentifier
SSH_AUTH_SOCK
XDG_CONFIG_HOME
TERM_SESSION_ID
PYENV_VIRTUALENV_DISABLE_PROMPT
EDITOR
PYENV_VERSION
PWD
LOGNAME
MANPATH
HOME
LANG
TMPDIR
SSH_CLIENT_USER
PIPENV_IGNORE_VIRTUALENVS
PYENV_DIR
PIPENV_HIDE_EMOJIS
TERM
USER
MANPAGER
SHLVL
GIT_EDITOR
PAGER
XPC_SERVICE_NAME
PYENV_ROOT
PATH
PIPENV_PYTHON
__CF_USER_TEXT_ENCODING
TERM_PROGRAM
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_VENV_IN_PROJECT
:1
PIPENV_IGNORE_VIRTUALENVS
:1
PIPENV_HIDE_EMOJIS
:1
PIPENV_PYTHON
:/Users/callen/.pyenv/shims/python
Debug–specific environment variables:
PATH
:/Users/callen/.pyenv/versions/3.10.11/bin:/Users/callen/.pyenv/versions/3.11.3/bin:/Users/callen/.pyenv/versions/3.8.10/bin:/Users/callen/.pyenv/versions/3.11.3/bin:/opt/homebrew/Cellar/pyenv/2.3.22/libexec:/opt/homebrew/Cellar/pyenv/2.3.22/plugins/python-build/bin:/Users/callen/.cargo/bin:/Users/callen/.pyenv/shims:/usr/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/callen/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
SHELL
:/bin/zsh
EDITOR
:/usr/local/bin/nova -w
LANG
:en_US.UTF-8
PWD
:/Users/callen/Desktop/foo
Contents of
Pipfile
('/Users/callen/Desktop/foo/Pipfile'):Contents of
Pipfile.lock
('/Users/callen/Desktop/foo/Pipfile.lock'):Thank you for taking the time to look at this issue, and for continuing to work on pipenv ❤️
The text was updated successfully, but these errors were encountered: