astral-sh / uv

An extremely fast Python package installer and resolver, written in Rust.
https://astral.sh/
Apache License 2.0
11.73k stars 321 forks source link

`==` requirements don't find local version labels #3276

Closed yorickvP closed 1 week ago

yorickvP commented 2 weeks ago

uv --version: uv 0.1.17 (15f6f9f44 2024-03-12)

I have a few requirements files that contain torch==2.1.2. When using the torch cuda index, pip resolves these to torch==2.1.2+cu121. In uv, I have to rewrite them to torch==2.1.2.*. It would be nice if there either was a wildcard for local version labels, or if the exact dependency would consider local version labels as well.

Unexpected behavior

$ echo 'torch==2.1.2' | uv pip compile - --annotation-style=line --extra-index-url https://download.pytorch.org/whl/cu121 --verbose
DEBUG Starting interpreter discovery for active Python
DEBUG Cached interpreter info for Python 3.11.8, skipping probing: /home/yorick/.nix-profile/bin/python3
DEBUG Using Python 3.11.8 interpreter at /home/yorick/.nix-profile/bin/python3 for builds
DEBUG Using registry request timeout of 300s
DEBUG Solving with target Python version 3.11.8
DEBUG Adding direct dependency: torch==2.1.2
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torch/
DEBUG Searching for a compatible version of torch (==2.1.2)
DEBUG No compatible version found for: torch
  × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of torch==2.1.2 and you require torch==2.1.2, we can conclude that the requirements are unsatisfiable.

Workaround

$ echo 'torch==2.1.2.*' | uv pip compile - --annotation-style=line --extra-index-url https://download.pytorch.org/whl/cu121 --verbose
verbose output ``` DEBUG Starting interpreter discovery for active Python DEBUG Cached interpreter info for Python 3.11.8, skipping probing: /home/yorick/.nix-profile/bin/python3 DEBUG Using Python 3.11.8 interpreter at /home/yorick/.nix-profile/bin/python3 for builds DEBUG Using registry request timeout of 300s DEBUG Solving with target Python version 3.11.8 DEBUG Adding direct dependency: torch>=2.1.2.dev0, <2.1.3.dev0 DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/torch/ DEBUG Searching for a compatible version of torch (>=2.1.2.dev0, <2.1.3.dev0) DEBUG Selecting: torch==2.1.2+cu121 (torch-2.1.2+cu121-cp311-cp311-linux_x86_64.whl) DEBUG Found fresh response for: https://download.pytorch.org/whl/cu121/torch-2.1.2%2Bcu121-cp311-cp311-linux_x86_64.whl#sha256=ca05cae9334504d1903e16c50ddf045329a859d5b1a27ed2dc1d58ed066df6fa DEBUG Adding transitive dependency: filelock* DEBUG Adding transitive dependency: typing-extensions* DEBUG Adding transitive dependency: sympy* DEBUG Adding transitive dependency: networkx* DEBUG Adding transitive dependency: jinja2* DEBUG Adding transitive dependency: fsspec* DEBUG Adding transitive dependency: triton==2.1.0 DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/filelock/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/typing-extensions/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/fsspec/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/sympy/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/networkx/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/jinja2/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/triton/ DEBUG Found stale response for: https://download.pytorch.org/whl/Jinja2-3.1.3-py3-none-any.whl#sha256=7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa DEBUG Sending revalidation request for: https://download.pytorch.org/whl/Jinja2-3.1.3-py3-none-any.whl#sha256=7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa DEBUG Found stale response for: https://download.pytorch.org/whl/fsspec-2024.2.0-py3-none-any.whl#sha256=817f969556fa5916bc682e02ca2045f96ff7f586d45110fcb76022063ad2c7d8 DEBUG Sending revalidation request for: https://download.pytorch.org/whl/fsspec-2024.2.0-py3-none-any.whl#sha256=817f969556fa5916bc682e02ca2045f96ff7f586d45110fcb76022063ad2c7d8 DEBUG Found fresh response for: https://download.pytorch.org/whl/triton-2.1.0-0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl#sha256=919b06453f0033ea52c13eaf7833de0e57db3178d23d4e04f9fc71c4f2c32bf8 DEBUG Found not-modified response for: https://download.pytorch.org/whl/Jinja2-3.1.3-py3-none-any.whl#sha256=7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa DEBUG Found not-modified response for: https://download.pytorch.org/whl/fsspec-2024.2.0-py3-none-any.whl#sha256=817f969556fa5916bc682e02ca2045f96ff7f586d45110fcb76022063ad2c7d8 DEBUG Found stale response for: https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl#sha256=f18c69adc97877c42332c170849c96cefa91881c99a7cb3e95b7c659ebdc1ec2 DEBUG Sending revalidation request for: https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl#sha256=f18c69adc97877c42332c170849c96cefa91881c99a7cb3e95b7c659ebdc1ec2 DEBUG Found fresh response for: https://download.pytorch.org/whl/sympy-1.12-py3-none-any.whl#sha256=c3588cd4295d0c0f603d0f2ae780587e64e2efeedb3521e46b9bb1d08d184fa5 DEBUG Found not-modified response for: https://download.pytorch.org/whl/networkx-3.2.1-py3-none-any.whl#sha256=f18c69adc97877c42332c170849c96cefa91881c99a7cb3e95b7c659ebdc1ec2 DEBUG Found stale response for: https://download.pytorch.org/whl/typing_extensions-4.9.0-py3-none-any.whl#sha256=af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd DEBUG Sending revalidation request for: https://download.pytorch.org/whl/typing_extensions-4.9.0-py3-none-any.whl#sha256=af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd DEBUG Found not-modified response for: https://download.pytorch.org/whl/typing_extensions-4.9.0-py3-none-any.whl#sha256=af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd DEBUG Searching for a compatible version of filelock (*) DEBUG Selecting: filelock==3.13.1 (filelock-3.13.1-py3-none-any.whl) DEBUG Found stale response for: https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl#sha256=57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c DEBUG Sending revalidation request for: https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl#sha256=57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c DEBUG Found not-modified response for: https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl#sha256=57dbda9b35157b05fb3e58ee91448612eb674172fab98ee235ccb0b5bee19a1c DEBUG Searching for a compatible version of typing-extensions (*) DEBUG Selecting: typing-extensions==4.9.0 (typing_extensions-4.9.0-py3-none-any.whl) DEBUG Searching for a compatible version of sympy (*) DEBUG Selecting: sympy==1.12 (sympy-1.12-py3-none-any.whl) DEBUG Adding transitive dependency: mpmath>=0.19 DEBUG Searching for a compatible version of networkx (*) DEBUG Selecting: networkx==3.2.1 (networkx-3.2.1-py3-none-any.whl) DEBUG Searching for a compatible version of jinja2 (*) DEBUG Selecting: jinja2==3.1.3 (Jinja2-3.1.3-py3-none-any.whl) DEBUG Adding transitive dependency: markupsafe>=2.0 DEBUG Searching for a compatible version of fsspec (*) DEBUG Selecting: fsspec==2024.2.0 (fsspec-2024.2.0-py3-none-any.whl) DEBUG Searching for a compatible version of triton (==2.1.0) DEBUG Selecting: triton==2.1.0 (triton-2.1.0-0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl) DEBUG Adding transitive dependency: filelock* DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/mpmath/ DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/markupsafe/ DEBUG Searching for a compatible version of mpmath (>=0.19) DEBUG Selecting: mpmath==1.3.0 (mpmath-1.3.0-py3-none-any.whl) DEBUG Found fresh response for: https://download.pytorch.org/whl/mpmath-1.3.0-py3-none-any.whl#sha256=a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c DEBUG Searching for a compatible version of markupsafe (>=2.0) DEBUG Selecting: markupsafe==2.1.5 (MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl) DEBUG Found stale response for: https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5 DEBUG Sending revalidation request for: https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5 DEBUG Found not-modified response for: https://download.pytorch.org/whl/MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5 ```
Resolved 10 packages in 1.50s
# This file was autogenerated by uv via the following command:
#    uv pip compile - --annotation-style=line
filelock==3.13.1          # via torch, triton
fsspec==2024.2.0          # via torch
jinja2==3.1.3             # via torch
markupsafe==2.1.5         # via jinja2
mpmath==1.3.0             # via sympy
networkx==3.2.1           # via torch
sympy==1.12               # via torch
torch==2.1.2+cu121
triton==2.1.0             # via torch
typing-extensions==4.9.0  # via torch
zanieb commented 2 weeks ago

Hi! Have you read the relevant section of our documentation? https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#local-version-identifiers

charliermarsh commented 1 week ago

I think this is covered by the compatibility guide.