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

Cache mismatch when installing a package for differents Python versions #12273

Closed
framillien opened this issue Mar 18, 2025 · 3 comments · Fixed by #12301
Closed

Cache mismatch when installing a package for differents Python versions #12273

framillien opened this issue Mar 18, 2025 · 3 comments · Fixed by #12301
Assignees
Labels
question Asking for clarification or support

Comments

@framillien
Copy link

framillien commented Mar 18, 2025

Summary

When a Python wheel is bound to specific Python versions, the installed version may not match the current Python version.

Package multiprocess is a wheel built for many Python versions:

  • multiprocess-0.70.17-py310-none-any.whl
  • multiprocess-0.70.17-py311-none-any.whl
  • ...

When we install multiprocess in a Python 3.10 venv, and then in a Python 3.11 or 3.12 venv, uv reuse the cache entry from Python 3.10 despite all information in logs are pointing to the expected package. Going from a higher version to a lower version work as expected (3.12 then 3.10). pip install the expected version.

Know workarounds are:

  • Add --no-cache on command line
  • Clean the cache after each installation uv cache clean multiprocess

How to reproduce (tested on Linux RHEL8 and Ubuntu22):

% uv cache clean multiprocess
% uv venv --python 3.10 .venv3-10
% uv pip install --python .venv3-10/bin/python3 multiprocess
% uv venv --python 3.11 .venv3-11
% uv pip install --python .venv3-11/bin/python3 multiprocess
% cat .venv3-11/lib/python3.11/site-packages/multiprocess-0.70.17.dist-info/WHEEL | grep Tag
Tag: py310-none-any

==> KO, must be py311 (same error if we activate the venv)

% uv cache clean multiprocess
% uv venv --python 3.11 .venv3-11
% uv pip install --python .venv3-11/bin/python3 multiprocess
% cat .venv3-11/lib/python3.11/site-packages/multiprocess-0.70.17.dist-info/WHEEL | grep Tag
Tag: py311-none-any

==> OK

Verbose log: uv-multiprocess-mismatch.txt

Platform

RHEL 8, Ubuntu 22

Version

uv 0.6.7

Python version

3.10, 3.11, 3.12

@framillien framillien added the bug Something isn't working label Mar 18, 2025
@charliermarsh
Copy link
Member

I think this might be correct, though. multiprocess-0.70.17-py310-none-any.whl means: "Any Python implementation with version 3.10 or later." That tag does not exclude Python 3.11.

Notice that pip will happily install it:

❯ pip --version
pip 22.3.1 from /usr/local/lib/python3.11/site-packages/pip (python 3.11)

❯ pip install https://files.pythonhosted.org/packages/e7/a9/39cf856d03690af6fd570cf40331f1f79acdbb3132a9c35d2c5002f7f30b/multiprocess-0.70.17-py310-none-any.whl
Collecting multiprocess==0.70.17
  Downloading multiprocess-0.70.17-py310-none-any.whl (134 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.8/134.8 kB 3.0 MB/s eta 0:00:00
...

❯ pip install https://files.pythonhosted.org/packages/c8/b7/2e9a4fcd871b81e1f2a812cd5c6fb52ad1e8da7bf0d7646c55eaae220484/multiprocess-0.70.17-py313-none-any.whl
ERROR: multiprocess-0.70.17-py313-none-any.whl is not a supported wheel on this platform

@charliermarsh charliermarsh added question Asking for clarification or support and removed bug Something isn't working labels Mar 18, 2025
@framillien
Copy link
Author

framillien commented Mar 18, 2025

Hi Charlie, and thanks for the quick answer. Agree that we can force PIP do install a specific version, but:

  • Does this behaviour be consistent in uv with or without cache ?
  • If uv resolve a specific version from indexes, does this version be installed regardless of the cache state ?
  • Does this behaviour be consistent with pip way to install packages.

In the log linked in the description, we see that uv resolve the expected version, but the cache install another one:

DEBUG Found fresh response for: https://files.pythonhosted.org/packages/a4/69/d3f343a61a2f86ef10ed7865a26beda7c71554136ce187b0384b1c2c9ca3/multiprocess-0.70.17-py312-none-any.whl.metadata

I think that the bug label is relevant for above reasons.

@charliermarsh
Copy link
Member

It seems reasonable to change this: #12301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants