git-cliff: BadZipFile error while installing via pip

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Unable to install git-cliff via pip

Steps To Reproduce

Brand new python venv

❯ python -m venv venv
❯ venv/Scripts/activate
❯ pip install setuptools wheel
Requirement already satisfied: setuptools in c:\users\karl.hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (63.2.0)
Requirement already satisfied: wheel in c:\users\karl.hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (0.37.1)

[notice] A new release of pip is available: 23.3.2 -> 24.0
[notice] To update, run: python.exe -m pip install --upgrade pip
❯ python.exe -m pip install --upgrade pip

zsh: command not found: python.exe
❯ python -m pip install --upgrade pip

Requirement already satisfied: pip in c:\users\karl.hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages (23.3.2)
Collecting pip
  Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)
Downloading pip-24.0-py3-none-any.whl (2.1 MB)
   ---------------------------------------- 2.1/2.1 MB 33.9 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.3.2
    Uninstalling pip-23.3.2:
      Successfully uninstalled pip-23.3.2
Successfully installed pip-24.0

Expected behavior

Git-Cliff should install

Screenshots / Logs

❯ pip install git-cliff
Collecting git-cliff
  Downloading git_cliff-2.1.2-py3-none-win_amd64.whl.metadata (6.1 kB)
Downloading git_cliff-2.1.2-py3-none-win_amd64.whl (6.4 MB)
   ---------------------------------------- 6.4/6.4 MB 14.1 MB/s eta 0:00:00
Installing collected packages: git-cliff
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\cli\base_command.py", line 180, in exc_logging_wrapper
    status = run_func(*args)
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\cli\req_command.py", line 245, in wrapper
    return func(self, options, args)
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\commands\install.py", line 452, in run
    installed = install_given_reqs(
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\req\__init__.py", line 72, in install_given_reqs
    requirement.install(
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\req\req_install.py", line 856, in install
    install_wheel(
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\operations\install\wheel.py", line 725, in install_wheel
    _install_wheel(
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\operations\install\wheel.py", line 585, in _install_wheel
    file.save()
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\operations\install\wheel.py", line 398, in save
    self._file.save()
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\site-packages\pip\_internal\operations\install\wheel.py", line 384, in save
    shutil.copyfileobj(f, dest)
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\shutil.py", line 195, in copyfileobj
    buf = fsrc_read(length)
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\zipfile.py", line 925, in read
    data = self._read1(n)
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\zipfile.py", line 1015, in _read1
    self._update_crc(data)
  File "C:\Users\Karl.Hudgell\.pyenv\pyenv-win\versions\3.10.6\lib\zipfile.py", line 943, in _update_crc
    raise BadZipFile("Bad CRC-32 for file %r" % self.name)
zipfile.BadZipFile: Bad CRC-32 for file 'git_cliff-2.1.2.data/scripts/git-cliff-completions.exe'

Software information

  • Operating system: Windows 10
  • Rust version: NA
  • Project version: NA
  • Python version: 3.10.6

Additional context

No response

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Reactions: 2
  • Comments: 53 (33 by maintainers)

Most upvoted comments

https://github.com/orhun/git-cliff/actions/runs/8491060435

Screenshot_%d

The git_cliff-2.2.0-py3-none-win_amd64.whl in these archives are valid.

I don’t know where wheels-x86_64-pc-windows-gnu is used. The version on pypi is wheels-x86_64-pc-windows-msvc with corrupted git-cliff-completions.exe.

$ find . -type f -exec sha256sum {} 

201db433a945a7502cf4f6e487044c1dae911336e55babd0d02147483851fd6a  ./pypi/git_cliff-2.2.0.dist-info/METADATA
e0d67ecd3747a0f9fadeeff14da771270862326289eeb949f6772e96aea7efe6  ./pypi/git_cliff-2.2.0.dist-info/WHEEL
8f1c58ea8c9a3f5cccd171beac989de62da7e11c2137107a9ab34d2e2ac02c6c  ./pypi/git_cliff-2.2.0.dist-info/RECORD
711fd3a58f36221c9f633e3b50efdfc6c102bdc9d1524d3c2575e505d57b12ba  ./pypi/git_cliff-2.2.0.data/scripts/git-cliff-completions.exe
dca0f554e1010708963d3a4e0c71f196639d3376c68cda62cf8286fe3195ab45  ./pypi/git_cliff-2.2.0.data/scripts/git-cliff-mangen.exe
5fec7ed499486e433c889efd55e8d3b748301cc4a966e1501acdb5e1d05ea8ac  ./pypi/git_cliff-2.2.0.data/scripts/git-cliff.exe

201db433a945a7502cf4f6e487044c1dae911336e55babd0d02147483851fd6a  ./wheels-x86_64-pc-windows-msvc/git_cliff-2.2.0.dist-info/METADATA
e0d67ecd3747a0f9fadeeff14da771270862326289eeb949f6772e96aea7efe6  ./wheels-x86_64-pc-windows-msvc/git_cliff-2.2.0.dist-info/WHEEL
8f1c58ea8c9a3f5cccd171beac989de62da7e11c2137107a9ab34d2e2ac02c6c  ./wheels-x86_64-pc-windows-msvc/git_cliff-2.2.0.dist-info/RECORD
2a811de078807e000a1494914178c7565641f5e2ecacb58bdf3d8c0ab60bfcbe  ./wheels-x86_64-pc-windows-msvc/git_cliff-2.2.0.data/scripts/git-cliff-completions.exe
dca0f554e1010708963d3a4e0c71f196639d3376c68cda62cf8286fe3195ab45  ./wheels-x86_64-pc-windows-msvc/git_cliff-2.2.0.data/scripts/git-cliff-mangen.exe
5fec7ed499486e433c889efd55e8d3b748301cc4a966e1501acdb5e1d05ea8ac  ./wheels-x86_64-pc-windows-msvc/git_cliff-2.2.0.data/scripts/git-cliff.exe

201db433a945a7502cf4f6e487044c1dae911336e55babd0d02147483851fd6a  ./wheels-x86_64-pc-windows-gnu/git_cliff-2.2.0.dist-info/METADATA
e0d67ecd3747a0f9fadeeff14da771270862326289eeb949f6772e96aea7efe6  ./wheels-x86_64-pc-windows-gnu/git_cliff-2.2.0.dist-info/WHEEL
b363d8db7f68b5f65f0a63fdbe781fa6cb4a3a5cc5cbfb026df3ba6bf3f857a0  ./wheels-x86_64-pc-windows-gnu/git_cliff-2.2.0.dist-info/RECORD
e95816287d3eed917e14f1ad480edbf87a8612b5a0f5459e7e03bcd231d60d6f  ./wheels-x86_64-pc-windows-gnu/git_cliff-2.2.0.data/scripts/git-cliff-completions.exe
712c5c05b72fa3b5fc996cc31b1bcf8714292cb8b50afb7a24c9da16b136485b  ./wheels-x86_64-pc-windows-gnu/git_cliff-2.2.0.data/scripts/git-cliff-mangen.exe
5bdf95d64be282af3d1935fadd6687e62f6a52ed73545eb2c290484d40338895  ./wheels-x86_64-pc-windows-gnu/git_cliff-2.2.0.data/scripts/git-cliff.exe
--- a/pypi
+++ b/wheels-x86_64-pc-windows-msvc
@@ -1,6 +1,6 @@
 201db433a945a7502cf4f6e487044c1dae911336e55babd0d02147483851fd6a  ./git_cliff-2.2.0.dist-info/METADATA
 e0d67ecd3747a0f9fadeeff14da771270862326289eeb949f6772e96aea7efe6  ./git_cliff-2.2.0.dist-info/WHEEL
 8f1c58ea8c9a3f5cccd171beac989de62da7e11c2137107a9ab34d2e2ac02c6c  ./git_cliff-2.2.0.dist-info/RECORD
-711fd3a58f36221c9f633e3b50efdfc6c102bdc9d1524d3c2575e505d57b12ba  ./git_cliff-2.2.0.data/scripts/git-cliff-completions.exe
+2a811de078807e000a1494914178c7565641f5e2ecacb58bdf3d8c0ab60bfcbe  ./git_cliff-2.2.0.data/scripts/git-cliff-completions.exe
 dca0f554e1010708963d3a4e0c71f196639d3376c68cda62cf8286fe3195ab45  ./git_cliff-2.2.0.data/scripts/git-cliff-mangen.exe
 5fec7ed499486e433c889efd55e8d3b748301cc4a966e1501acdb5e1d05ea8ac  ./git_cliff-2.2.0.data/scripts/git-cliff.exe

Apparently the error is somewhere at the Publish PyPI package stage.

https://github.com/orhun/git-cliff/blob/98647800565f588f656234f5b717d3ce35db3344/.github/workflows/cd.yml#L321-L338

I can only note that git_cliff-2.2.0-py3-none-win_amd64.whl is extracted from both wheels-x86_64-pc-windows-gnu and wheels-x86_64-pc-windows-msvc. Apparently, the latter (msvc) overwrites the former (gnu). Maybe the archive gets corrupted somehow when it is overwritten?

Screenshot_%d-2

Changes to Publish PyPI package stage between working and non-working versions:

https://github.com/orhun/git-cliff/compare/v1.4.0..v2.0.0#diff-ea3ea8c9932adc7ba8161ceda844fedd43b006848ef1140c050cbd7ea0788a18R318-R325

Have just spun up windows sandbox, installed python 3.10.6 (without using pyenv) and installed poetry using pipx as suggested…but still the same issue

image

I’m not 100% on that, but if the wheel gets published, I can try install it and see if it works, if not then it looks like updating as they said would work, or using the latest with 3.11 would work as you said…thanks for looking into all of this…

Glad this has helped, I would much prefer to install via the project deps than have to have people install on their mac/win using wget/brew…

@orhun I just downloaded the wheel file manually via the pypi webpage and tried to install using pip add “pathtowheel” and the whl can be opened in any zip program, i used peazip, but you gett he same crc issue…

glad it looks like this might go soemwehre and get fixed, thanks for your help guys…

I pushed f675b0b5bdbe57437e39dbe4c0b78e7c4f373936 and planning to create a release soon, let’s see

Sorry guys, I have been sick, but I am back now…

Sadly, I seem to still be getting the same issue with 2.2.0 that is on pypi at the moment, not too sure what is going on, I have even update my python to 3.10.6 since (was running on 3.8)

Updating dependencies
Resolving dependencies... (7.6s)

Package operations: 1 install, 1 update, 0 removals

  - Installing git-cliff (2.2.0): Failed

  BadZipFile

  Bad CRC-32 for file 'git_cliff-2.2.0.data/scripts/git-cliff-completions.exe'

  at c:\users\karl.hudgell\.pyenv\pyenv-win\versions\3.8.10\lib\zipfile.py:958 in _update_crc
       954│             return
       955│         self._running_crc = crc32(newdata, self._running_crc)
       956│         # Check the CRC if we're at the end of the file
       957│         if self._eof and self._running_crc != self._expected_crc:
    →  958│             raise BadZipFile("Bad CRC-32 for file %r" % self.name)
       959│
       960│     def read1(self, n):
       961│         """Read up to n bytes with at most one read() system call."""
       962│

Cannot install git-cliff.

PS C:\Users\Karl.Hudgell\Documents\Work\HE\regression-testing-package\data_generator>

Oh no, a heisenbug!

So my release worked. Here it is on TestPyPi. Please ignore the version number, that’s just a result of me hacking at it until I could push it through.

Things I chopped off include: NPM, deb, RPM, cargo, and homebrew publishing… but perhaps most relevant given the checksum mismatch error is the fact that I removed the signing. See this diff, focusing on changes to cd.yaml – other changes shouldn’t matter (I accidentally based this on another branch).

Needs a bit more thought here.

Btw, I might suggest skipping the pypi release for v2.2.0 if you just want to get the release out. We can catch up again on 2.2.1

I took a look as well and nothing stands out. I have also verified that the wheel is installable on my Windows system so that’s good at least.

I’ll attempt to debug the publishing issue in a fork.

Odd… I just got back from a trip but I’ll review the log after work and let you know.

Looks like 1.8.2 poetry supports the latest wheels, can we get them published to Pypi?

Looks like the metadata-version was bumped to 2.3 as of maturin 1.5.0: https://github.com/PyO3/maturin/pull/1965

Comparing the METADATA file from the 2.1.2 wheel on PIP and the workflow wheel above, it seems like everything is the same except for the Metadata-Version field, so I’m not sure we can avoid this without pinning maturin to 1.4.0, but this is a bit deeper in the packaging rabbit hole than I’m used to.

@radusuciu I have downloaded and tested your artifact this morning and all seems to be well…

I used poetry and tried to install using that and did…get and error…

> poetry add .\wheels-x86_64-pc-windows-msvc\git_cliff-2.1.6-py3-none-win_amd64.whl

Unable to create package with no name

But then tried with pip in my poetry env and it worked ok.

> pip install .\wheels-x86_64-pc-windows-msvc\git_cliff-2.1.6-py3-none-win_amd64.whl
Processing \wheels-x86_64-pc-windows-msvc\git_cliff-2.1.6-py3-none-win_amd64.whl
Installing collected packages: git-cliff
Successfully installed git-cliff-2.1.6

And was able to build changelog, so def progress, I will have a play today and see if I can understand why poetry couldn’t install, as I quite often install direct from wheels and it works fine…

thanks for your help/work

I think duplication is fine - let’s have the basic checks and then we can worry about refactoring it 🐻

Yup, we can place it in ci.yml.

I see, should we expect it to be fixed after #539?

I’m not 100% since I could not reproduce the failure locally, but I did verify that the wheels generated in my hacked (removed a few irrelevant jobs) fork are installable on my Windows computer.

Relevant job: https://github.com/radusuciu/git-cliff/actions/runs/8182476507/job/22373882202 Wheel artifact: https://github.com/radusuciu/git-cliff/actions/runs/8182476507/artifacts/1304538766

To avoid this problem in the future, it might be good to build wheels during CI and test whether they can be installed at least. Alternatively it could be added as another CD step during the pre-release process.

Guessing this is the culprit: https://github.com/orhun/git-cliff/blob/16bea5179a89af26dd0bfb07c7d6b7d1efa3c54e/pypi/pyproject.toml#L2

I was way too specific in pinning this version of maturin. There’s been a 1.0 release since then so I’m going to test locally if this creates an installable wheel.

you rang?

I can take a look. I’ve been using the pypi package in a few projects without issues but it’s all been Linux or WSL. I would also suspect that maturin might be involved…