-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Some packages can not be installed with uv contrary to pip, like ziglang #6615
Description
Hello 🙂 First let me thank you for this awesome project !! ❤️
The issue
By using uv, I somehow managed to find a strange behaviour in wheel installations.
Indeed, on Linux, I was not able to install the ziglang package with uv.
Here is the error message:
(fixeduv) root@871e96b7ad46:/uv# uv pip install ziglang
Resolved 1 package in 225ms
error: Failed to install: ziglang-0.13.0-py3-none-manylinux_2_17_aarch64.many
linux2014_aarch64.musllinux_1_1_aarch64.http.whl (ziglang==0.13.0)
Caused by: The wheel is invalid: Line 5 of the WHEEL file is invalidThe cause
So I looked at the WHEEL file content:
Wheel-Version: 1.0
Generator: ziglang make_wheels.py
Root-Is-Purelib: false
Tag:
py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64Hint: the markdown syntax is
You can reproduce the parsing error with a unit test testing this wheel content here
Meanwhile, pip can totally install it.
We can directly see that the tag value is containing a linesep and two spaces. So we could say that the wheel is indeed invalid, and uv is not to blame here. But the fact is that pip is installing the wheel without any issue...
So i looked at the source code of uv and pip. And I discovered that the parsing method was not the same.
While uv is using a simple key value text file parsing method, pip is using email.message_from_file function from the python standard library, as you can see here.
But not only uv, bdist_wheel too
So I deduced that the WHEEL and METADATA files should be generated with email headers syntax.
Furthermore, by looking at the source code of uv and pip, we can also see that the Tag field is totally useless and not read, because both are fetching the tag from the wheel filename. So this issue is only a parsing file method issue.
But then I was then wondering, what could be the reason making uv maintainers not using the same parsing method ? For sure the PEP specification fo the wheels should tell that we need to use email messages formats right ?
But the PEP is in fact only talking about basic key value format

I should probably contact them in order to have their opinion! 😄
Solution
I think the solution here is pretty simple : let's use the same parsing method as pip, which is parsing these file as email messages! 🚀
uv needs to be as fast as possible, so I found the mail_parser crate
And the test runs as fast as the previous parsing method, sometimes even faster.
I will linked the pull-request #6616: waiting for your opinion! 😊
I also added a unit test for this specific use case.
Here is the result:
(fixeduv) root@871e96b7ad46:/uv# uv pip install ziglang
Resolved 1 package in 225ms
error: Failed to install: ziglang-0.13.0-py3-none-manylinux_2_17_aarch64.many
linux2014_aarch64.musllinux_1_1_aarch64.http.whl (ziglang==0.13.0)
Caused by: The wheel is invalid: Line 5 of the WHEEL file is invalid
(fixeduv) root@871e96b7ad46:/uv# ./target/release/uv pip install ziglang
Resolved 1 package in 3ms
Installed 1 package in 177ms
+ ziglang==0.13.0
(fixeduv) root@871e96b7ad46:/uv# uname -a
Linux 871e96b7ad46 6.8.11-300.fc40.aarch64 #1 SMP PREEMPT_DYNAMIC Mon May 27
15:22:03 UTC 2024 aarch64 GNU/LinuxThanks !!! I am open to anything if needed, first contribution on this awesome project here 😄