astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
22.96k stars 665 forks source link

UV barfs on virtualenvs containing packages with local version identifiers #8231

Open arrdem opened 8 hours ago

arrdem commented 8 hours ago
(abnormal) ➜  source git:(main) uv --version
uv 0.4.21 (Homebrew 2024-10-14)
(abnormal) ➜  source git:(main) venv-sync
Using Python 3.11.10 environment at /Users/gsirois/venvs/python3.11-2
error: Failed to read metadata from: `/Users/gsirois/venvs/python3.11-2/lib/python3.11/site-packages/protobuf-4.25.3.post1_abnormal.87071f8fe87.dist-info`
  Caused by: after parsing `4.25.3.post1`, found `_abnormal.87071f8fe87`, which is not part of a valid version

Per https://packaging.python.org/en/latest/specifications/version-specifiers/#local-version-identifiers it is expected that Python packaging implementations support + symbols in the version number as a "local" part. It appears that during installation at least some versions of pip normalize local version suffixes using _ which breaks UV.

charliermarsh commented 8 hours ago

I don't see anything in the spec suggesting that the + should be replaced there -- that seems like a bug somewhere else?

arrdem commented 8 hours ago

Yeah I agree with you on the spec -- trying to find where this is coming from ~in pip~. Edit: Doesn't seem to be pip behavior.

arrdem commented 8 hours ago

This is pretty clearly something that came out of an old python3 -m build... the wheel artifact contains the _ part in its .dist-info tree. Question is how.