Skip to content
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

Requirements output different since 2023.7.1 causing pip install issues #5777

Closed
timhourigan opened this issue Jul 4, 2023 · 0 comments · Fixed by #5778
Closed

Requirements output different since 2023.7.1 causing pip install issues #5777

timhourigan opened this issue Jul 4, 2023 · 0 comments · Fixed by #5778

Comments

@timhourigan
Copy link
Contributor

Issue description

The output of pipenv requirements --hash has changed slightly in 2023.7.1 (#5757) and pip appears to be sensitive to it in some scenarios, causing pip to be unable to install the package(s) from the generated requirements.txt.

Snippet of requirements.txt generated with 2023.6.26

pyzip==0.2.0 ; python_version >= '3.1' --hash=sha256:c0b10776d798e4be9d5fe6eec541dd0a9740b6550b12fd4cfa238a085686a298

Snippet of requirements.txt generated with 2023.7.1 - The hash is now before the marker

pyzip==0.2.0 --hash=sha256:c0b10776d798e4be9d5fe6eec541dd0a9740b6550b12fd4cfa238a085686a298; python_version >= '3.1'

Expected result

  • 2023.7.1 generates a requirements.txt as per 2023.6.26

Actual result

  • 2023.7.1 generates a slightly different requirements.txt

Steps to replicate

Pip successfully installs the package with the 2023.6.26 requirements.txt:

$ pipenv run pip --version
pip 23.1.2

$ cat requirements_2023.6.26.txt
pyzip==0.2.0 ; python_version >= '3.1' --hash=sha256:c0b10776d798e4be9d5fe6eec541dd0a9740b6550b12fd4cfa238a085686a298

$ pipenv run pip install -r requirements_2023.6.26.txt -t test_dir
Collecting pyzip==0.2.0 (from -r requirements_2023.6.26.txt (line 1))
  Using cached pyzip-0.2.0-py3-none-any.whl
Installing collected packages: pyzip
Successfully installed pyzip-0.2.0

Pip fails to install the package with the 2023.7.3 requirements.txt, thinking there is a hash mismatch even though it displays two identical shas:

$ pipenv run pip --version
pip 23.1.2

$ cat requirements_2023.7.1.txt
pyzip==0.2.0 --hash=sha256:c0b10776d798e4be9d5fe6eec541dd0a9740b6550b12fd4cfa238a085686a298; python_version >= '3.1'

$ pipenv run pip install -r requirements_2023.7.1.txt -t test_dir
Collecting pyzip==0.2.0 (from -r requirements_2023.7.1.txt (line 1))
  Using cached pyzip-0.2.0-py3-none-any.whl
  WARNING: The hashes of the source archive found in cache entry don't match, ignoring cached built wheel and re-downloading source.
  Using cached pyzip-0.2.0.tar.gz (6.3 kB)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
    pyzip==0.2.0 from https://files.pythonhosted.org/packages/40/72/e29470ecfb5f2bc8cdd2a1b8a6aa14af8d44aa08fe5efa407cd991ce2c64/pyzip-0.2.0.tar.gz (from -r requirements_2023.7.1.txt (line 1)):
        Expected sha256 c0b10776d798e4be9d5fe6eec541dd0a9740b6550b12fd4cfa238a085686a298;
             Got        c0b10776d798e4be9d5fe6eec541dd0a9740b6550b12fd4cfa238a085686a298

I will raise a PR with a fix for consideration.

timhourigan added a commit to timhourigan/pipenv that referenced this issue Jul 4, 2023
timhourigan added a commit to timhourigan/pipenv that referenced this issue Jul 4, 2023
timhourigan added a commit to timhourigan/pipenv that referenced this issue Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant