astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

rye fails to find existing version of package #1282

Closed jamesWalker55 closed 2 months ago

jamesWalker55 commented 2 months ago

Steps to Reproduce

# create temp folder
mkdir temp
cd temp

# new project
rye init --py 3.12.3
rye sync

# add requests 2.32.3
rye add requests==2.32.3
# error: Failed to run uv compile   × No solution found when resolving dependencies:
#   ╰─▶ Because there is no version of requests==2.32.3 and you require
#       requests==2.32.3, we can conclude that the requirements are
#       unsatisfiable.
# . uv exited with status: exit code: 1

Expected Result

It adds requests version 2.32.3. The version is available here: https://pypi.org/project/requests/2.32.3/

Actual Result

error: Failed to run uv compile   × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of requests==2.32.3 and you require
      requests==2.32.3, we can conclude that the requirements are
      unsatisfiable.
. uv exited with status: exit code: 1

Version Info

rye 0.37.0 commit: 0.37.0 (09b67c469 2024-07-20) platform: windows (x86_64) self-python: cpython@3.12.3 symlink support: true uv enabled: true

Stacktrace

No response

flyaroundme commented 2 months ago

Is the issue still there on your machine? Was trying to reproduce and was not successful with that. Tried both Powershell and Cmd...

jamesWalker55 commented 2 months ago

Yes, I've reproduced it just now: image

charliermarsh commented 2 months ago

Trying to think of how this could be possible -- works as expected for me:

~/workspace on  main [!+?] via 🐍 v3.10.14
❯ cd temp
~/workspace/temp on  main [!+?]
❯ rye init
success: Initialized project in /Users/crmarsh/workspace/temp/.
  Run `rye sync` to get started
~/workspace/temp on  main [!+?] is 📦 v0.1.0 via 🐍 v3.12.3
❯ rye sync
Initializing new virtualenv in /Users/crmarsh/workspace/temp/.venv
Python version: cpython@3.12.3
Generating production lockfile: /Users/crmarsh/workspace/temp/requirements.lock
Generating dev lockfile: /Users/crmarsh/workspace/temp/requirements-dev.lock
Installing dependencies
Resolved 1 package in 1ms
Building temp @ file:///Users/crmarsh/workspace/temp
   Built temp @ file:///Users/crmarsh/workspace/temp
Prepared 1 package in 416ms
Installed 1 package in 0.90ms
 + temp==0.1.0 (from file:///Users/crmarsh/workspace/temp)
Done!
~/workspace/temp on  main [!+?] is 📦 v0.1.0 via 🐍 v3.12.3
❯ rye add requests==2.32.3
Added requests==2.32.3 as regular dependency
Reusing already existing virtualenv
Generating production lockfile: /Users/crmarsh/workspace/temp/requirements.lock
Generating dev lockfile: /Users/crmarsh/workspace/temp/requirements-dev.lock
Installing dependencies
Resolved 6 packages in 2ms
   Built temp @ file:///Users/crmarsh/workspace/temp
Prepared 6 packages in 153ms
Uninstalled 1 package in 0.47ms
Installed 6 packages in 2ms
 + certifi==2024.7.4
 + charset-normalizer==3.3.2
 + idna==3.7
 + requests==2.32.3
 - temp==0.1.0 (from file:///Users/crmarsh/workspace/temp)
 + temp==0.1.0 (from file:///Users/crmarsh/workspace/temp)
 + urllib3==2.2.2
Done!

Can you include the output of running with --verbose? You must not be able to access the index for some reason (or you have an alternate index configured and don't realize it).

jamesWalker55 commented 2 months ago

Here's the output when I add --verbose to each command:

PS D:\Programming\krita-scripting> # create temp folder
>> mkdir temp
>> cd temp
>>

    Directory: D:\Programming\krita-scripting

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2024-07-28     01:27                temp

PS D:\Programming\krita-scripting\temp> rye init --py 3.12.3 --verbose
success: Initialized project in D:\Programming\krita-scripting\temp\.
  Run `rye sync` to get started
PS D:\Programming\krita-scripting\temp> rye sync --verbose
Python version already downloaded. Skipping.
Initializing new virtualenv in D:\Programming\krita-scripting\temp\.venv
Python version: cpython@3.12.3
Using Python 3.12.3 interpreter at: C:\Users\James\.rye\py\cpython@3.12.3\python.exe
Creating virtualenv at: .venv
Activate with: .venv\Scripts\activate
Generating production lockfile: D:\Programming\krita-scripting\temp\requirements.lock
Resolved 1 package in 25ms
-e file:.
    # via -r C:/Users/James/AppData/Local/Temp/.tmpaFZoz7
Generating dev lockfile: D:\Programming\krita-scripting\temp\requirements-dev.lock
Resolved 1 package in 3ms
-e file:.
    # via -r C:/Users/James/AppData/Local/Temp/.tmp29ZvsK
Installing dependencies
DEBUG uv 0.2.27
DEBUG Searching for Python interpreter in system path or `py` launcher
DEBUG Found cpython 3.12.3 at `D:\Programming\krita-scripting\temp\.venv\Scripts\python.exe` (active virtual environment)
DEBUG Using Python 3.12.3 environment at .venv\Scripts\python.exe
DEBUG Acquired lock for `.venv`
DEBUG Using request timeout of 30s
DEBUG Found PEP 621 metadata for D:\Programming\krita-scripting\temp in `pyproject.toml` (temp)
DEBUG Solving with installed Python version: 3.12.3
DEBUG Adding direct dependency: temp*
DEBUG Searching for a compatible version of temp @ file:///D:/Programming/krita-scripting/temp (*)
DEBUG Acquired lock for `\\?\C:\Users\James\AppData\Local\uv\cache\built-wheels-v3\editable\b0baee121f5fccb0`
DEBUG Preparing metadata for: temp @ file:///D:/Programming/krita-scripting/temp
DEBUG No static `PKG-INFO` available for: temp @ file:///D:/Programming/krita-scripting/temp (MissingPkgInfo)
DEBUG Found static `pyproject.toml` for: temp @ file:///D:/Programming/krita-scripting/temp
DEBUG No workspace root found, using project root
DEBUG Tried 1 versions: temp 1
DEBUG Split specific environment resolution took 0.009s
Resolved 1 package in 12ms
DEBUG Identified uncached requirement: temp @ file:///D:/Programming/krita-scripting/temp
DEBUG Acquired lock for `\\?\C:\Users\James\AppData\Local\uv\cache\built-wheels-v3\editable\b0baee121f5fccb0`
DEBUG Building: temp @ file:///D:/Programming/krita-scripting/temp
INFO Ignoring empty directory
DEBUG Solving with installed Python version: 3.12.3
DEBUG Adding direct dependency: hatchling*
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/hatchling/
DEBUG Found fresh response for: https://pypi.org/simple/hatchling/
DEBUG Searching for a compatible version of hatchling (*)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/0c/8b/90e80904fdc24ce33f6fc6f35ebd2232fe731a8528a22008458cf197bc4d/hatchling-1.25.0-py3-none-any.whl.metadata
DEBUG Selecting: hatchling==1.25.0 [compatible] (hatchling-1.25.0-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.25.0: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.25.0: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.25.0: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.25.0: trove-classifiers*
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/packaging/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/pathspec/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/pluggy/
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/trove-classifiers/
DEBUG Searching for a compatible version of packaging (>=23.2)
DEBUG No compatible version found for: packaging
DEBUG Searching for a compatible version of hatchling (<1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.24.2 [compatible] (hatchling-1.24.2-py3-none-any.whl)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/5f/20/b890241570ac3ba6508febab3104eeb1acd7ffba1bd3447190f56151f1bc/hatchling-1.24.2-py3-none-any.whl.metadata
DEBUG Adding transitive dependency for hatchling==1.24.2: packaging>=23.2
DEBUG Found fresh response for: https://pypi.org/simple/pathspec/
DEBUG Adding transitive dependency for hatchling==1.24.2: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.24.2: pluggy>=1.0.0
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl.metadata
DEBUG Adding transitive dependency for hatchling==1.24.2: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.24.1 [compatible] (hatchling-1.24.1-py3-none-any.whl)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/e5/d1/9e933f6ed4276c448806968a97d42ad4ed3e8d8722541fba5f75571d9add/hatchling-1.24.1-py3-none-any.whl.metadata
DEBUG Adding transitive dependency for hatchling==1.24.1: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.24.1: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.24.1: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.24.1: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.24.1 | >1.24.1, <1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/36/47/8266533720febfb0640ba1c93ab2edb83be4091dcfb107595cc8bbbb99ef/hatchling-1.24.0-py3-none-any.whl.metadata
DEBUG Selecting: hatchling==1.24.0 [compatible] (hatchling-1.24.0-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.24.0: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.24.0: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.24.0: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.24.0: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.24.0 | >1.24.0, <1.24.1 | >1.24.1, <1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/b8/f3/565163cc52fe6c330ad59b17204701a85e0440af6b5463dc0613a93c4212/hatchling-1.23.0-py3-none-any.whl.metadata
DEBUG Selecting: hatchling==1.23.0 [compatible] (hatchling-1.23.0-py3-none-any.whl)
DEBUG Prefetching 5 hatchling versions
DEBUG Adding transitive dependency for hatchling==1.23.0: packaging>=23.2
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/52/6a/5e6a176ac6be3d3c36dded0b0d346f7059f83268716cc88f707b16f711f5/hatchling-1.22.5-py3-none-any.whl.metadata
DEBUG Adding transitive dependency for hatchling==1.23.0: pathspec>=0.10.1
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/49/63/2d56d6356f9f8b906aa68335cbf5b1b54c69873a2e271eda2ddba319c1ae/hatchling-1.22.4-py3-none-any.whl.metadata
DEBUG Adding transitive dependency for hatchling==1.23.0: pluggy>=1.0.0
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/2d/31/b4ffda996d1e21bb7096fd377b0437f4925351c2f60dbe9563e83705744c/hatchling-1.22.3-py3-none-any.whl.metadata
DEBUG Adding transitive dependency for hatchling==1.23.0: trove-classifiers*
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/7d/a4/c69d252d72d61591c2f9354f30fe39927256ec0615f77d16d419a7b98d28/hatchling-1.22.2-py3-none-any.whl.metadata
DEBUG Searching for a compatible version of hatchling (<1.23.0 | >1.23.0, <1.24.0 | >1.24.0, <1.24.1 | >1.24.1, <1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.22.5 [compatible] (hatchling-1.22.5-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.22.5: packaging>=21.3
DEBUG Adding transitive dependency for hatchling==1.22.5: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.22.5: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.22.5: trove-classifiers*
DEBUG Searching for a compatible version of packaging (>=21.3, <23.2)
DEBUG Found fresh response for: https://download.pytorch.org/whl/packaging-22.0-py3-none-any.whl#sha256=957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3
DEBUG Selecting: packaging==22.0 [compatible] (packaging-22.0-py3-none-any.whl)
DEBUG Searching for a compatible version of pathspec (>=0.10.1)
DEBUG Selecting: pathspec==0.12.1 [compatible] (pathspec-0.12.1-py3-none-any.whl)
DEBUG Found fresh response for: https://pypi.org/simple/pluggy/
DEBUG Searching for a compatible version of pluggy (>=1.0.0)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl.metadata
DEBUG Selecting: pluggy==1.5.0 [compatible] (pluggy-1.5.0-py3-none-any.whl)
DEBUG Found fresh response for: https://pypi.org/simple/trove-classifiers/
DEBUG Searching for a compatible version of trove-classifiers (*)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/0f/b0/09794439a62a7dc18bffdbf145aaf50297fd994890b11da27a13e376b947/trove_classifiers-2024.7.2-py3-none-any.whl.metadata
DEBUG Selecting: trove-classifiers==2024.7.2 [compatible] (trove_classifiers-2024.7.2-py3-none-any.whl)
DEBUG Tried 11 versions: hatchling 6, packaging 2, pathspec 1, pluggy 1, trove-classifiers 1
DEBUG Split specific environment resolution took 1.934s
DEBUG Installing in hatchling==1.22.5, packaging==22.0, pathspec==0.12.1, pluggy==1.5.0, trove-classifiers==2024.7.2 in \\?\C:\Users\James\AppData\Local\uv\cache\builds-v0\.tmp7e39IF
DEBUG Requirement already cached: hatchling==1.22.5
DEBUG Requirement already cached: packaging==22.0
DEBUG Requirement already cached: pathspec==0.12.1
DEBUG Requirement already cached: pluggy==1.5.0
DEBUG Requirement already cached: trove-classifiers==2024.7.2
DEBUG Installing build requirements: hatchling==1.22.5, packaging==22.0, pathspec==0.12.1, pluggy==1.5.0, trove-classifiers==2024.7.2
DEBUG Calling `hatchling.build.get_requires_for_build_editable()`
DEBUG Installing extra requirements for build backend
DEBUG Solving with installed Python version: 3.12.3
DEBUG Adding direct dependency: hatchling*
DEBUG Adding direct dependency: editables>=0.3, <1.dev0
DEBUG Searching for a compatible version of hatchling (*)
DEBUG No cache entry for: https://download.pytorch.org/whl/cu121/editables/
DEBUG Selecting: hatchling==1.25.0 [compatible] (hatchling-1.25.0-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.25.0: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.25.0: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.25.0: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.25.0: trove-classifiers*
DEBUG Found fresh response for: https://pypi.org/simple/editables/
DEBUG Searching for a compatible version of editables (>=0.3, <1.dev0)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/6b/be/0f2f4a5e8adc114a02b63d92bf8edbfa24db6fc602fca83c885af2479e0e/editables-0.5-py3-none-any.whl.metadata
DEBUG Selecting: editables==0.5 [compatible] (editables-0.5-py3-none-any.whl)
DEBUG Searching for a compatible version of packaging (>=23.2)
DEBUG No compatible version found for: packaging
DEBUG Searching for a compatible version of hatchling (<1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.24.2 [compatible] (hatchling-1.24.2-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.24.2: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.24.2: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.24.2: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.24.2: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.24.1 [compatible] (hatchling-1.24.1-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.24.1: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.24.1: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.24.1: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.24.1: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.24.1 | >1.24.1, <1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.24.0 [compatible] (hatchling-1.24.0-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.24.0: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.24.0: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.24.0: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.24.0: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.24.0 | >1.24.0, <1.24.1 | >1.24.1, <1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.23.0 [compatible] (hatchling-1.23.0-py3-none-any.whl)
DEBUG Prefetching 5 hatchling versions
DEBUG Adding transitive dependency for hatchling==1.23.0: packaging>=23.2
DEBUG Adding transitive dependency for hatchling==1.23.0: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.23.0: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.23.0: trove-classifiers*
DEBUG Searching for a compatible version of hatchling (<1.23.0 | >1.23.0, <1.24.0 | >1.24.0, <1.24.1 | >1.24.1, <1.24.2 | >1.24.2, <1.25.0 | >1.25.0)
DEBUG Selecting: hatchling==1.22.5 [compatible] (hatchling-1.22.5-py3-none-any.whl)
DEBUG Adding transitive dependency for hatchling==1.22.5: packaging>=21.3
DEBUG Adding transitive dependency for hatchling==1.22.5: pathspec>=0.10.1
DEBUG Adding transitive dependency for hatchling==1.22.5: pluggy>=1.0.0
DEBUG Adding transitive dependency for hatchling==1.22.5: trove-classifiers*
DEBUG Searching for a compatible version of editables (>=0.3, <1.dev0)
DEBUG Selecting: editables==0.5 [compatible] (editables-0.5-py3-none-any.whl)
DEBUG Searching for a compatible version of packaging (>=21.3, <23.2)
DEBUG Selecting: packaging==22.0 [compatible] (packaging-22.0-py3-none-any.whl)
DEBUG Searching for a compatible version of pathspec (>=0.10.1)
DEBUG Selecting: pathspec==0.12.1 [compatible] (pathspec-0.12.1-py3-none-any.whl)
DEBUG Searching for a compatible version of pluggy (>=1.0.0)
DEBUG Selecting: pluggy==1.5.0 [compatible] (pluggy-1.5.0-py3-none-any.whl)
DEBUG Searching for a compatible version of trove-classifiers (*)
DEBUG Selecting: trove-classifiers==2024.7.2 [compatible] (trove_classifiers-2024.7.2-py3-none-any.whl)
DEBUG Tried 13 versions: hatchling 6, editables 2, packaging 2, pathspec 1, pluggy 1, trove-classifiers 1
DEBUG Split specific environment resolution took 0.844s
DEBUG Installing in editables==0.5, hatchling==1.22.5, packaging==22.0, pathspec==0.12.1, pluggy==1.5.0, trove-classifiers==2024.7.2 in \\?\C:\Users\James\AppData\Local\uv\cache\builds-v0\.tmp7e39IF
DEBUG Requirement already cached: editables==0.5
DEBUG Requirement already installed: hatchling==1.22.5
DEBUG Requirement already installed: packaging==22.0
DEBUG Requirement already installed: pathspec==0.12.1
DEBUG Requirement already installed: pluggy==1.5.0
DEBUG Requirement already installed: trove-classifiers==2024.7.2
DEBUG Installing build requirement: editables==0.5
DEBUG Calling `hatchling.build.build_editable("\\\\?\\C:\\Users\\James\\AppData\\Local\\uv\\cache\\built-wheels-v3\\editable\\b0baee121f5fccb0\\EZqDRRA9zgActQoyEo6vt\\.tmpwg1oGA", {}, None)`
DEBUG Finished building: temp @ file:///D:/Programming/krita-scripting/temp
Prepared 1 package in 3.08s
warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance. If this is intentional, use `--link-mode=copy` to suppress this warning.

hint: If the cache and target directories are on different filesystems, hardlinking may not be supported.
Installed 1 package in 3ms
 + temp==0.1.0 (from file:///D:/Programming/krita-scripting/temp)
Done!
PS D:\Programming\krita-scripting\temp> rye add requests==2.32.3 --verbose
error: Failed to run uv compile   × No solution found when resolving dependencies:
  ╰─▶ Because there is no version of requests==2.32.3 and you require
      requests==2.32.3, we can conclude that the requirements are
      unsatisfiable.
. uv exited with status: exit code: 1
PS D:\Programming\krita-scripting\temp>

Not sure what an alternate index is. Here's my rye config in case it has anything weird:

[behavior]
use-uv = true
global-python = true

[default]
toolchain = "cpython@3.12"

[[sources]]
name = "pytorch"
url = "https://download.pytorch.org/whl/cu121"
charliermarsh commented 2 months ago

It looks like you're using the PyTorch index, but that version of request doesn't exist on that index: https://download.pytorch.org/whl/requests/. You can use 2.28.1 instead, or try to add an additional index.

jamesWalker55 commented 2 months ago

Is it possible to keep the pytorch index, but have rye prefer the requests package on pypi instead?

charliermarsh commented 2 months ago

You can set the UV_INDEX_STRATEGY=unsafe-best-match environment variable, e.g.:

UV_INDEX_STRATEGY=unsafe-best-match rye add requests==2.32.

Docs here: https://github.com/astral-sh/uv/blob/main/PIP_COMPATIBILITY.md#packages-that-exist-on-multiple-indexes