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)
https://github.com/orhun/git-cliff/actions/runs/8491060435
The
git_cliff-2.2.0-py3-none-win_amd64.whlin these archives are valid.I don’t know where
wheels-x86_64-pc-windows-gnuis used. The version onpypiiswheels-x86_64-pc-windows-msvcwith corruptedgit-cliff-completions.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.whlis extracted from bothwheels-x86_64-pc-windows-gnuandwheels-x86_64-pc-windows-msvc. Apparently, the latter (msvc) overwrites the former (gnu). Maybe the archive gets corrupted somehow when it is overwritten?Changes to
Publish PyPI packagestage 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
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)
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 mismatcherror is the fact that I removed the signing. See this diff, focusing on changes tocd.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-Versionfield, 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…
But then tried with pip in my poetry env and it worked ok.
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’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…