#1477·rye

UV interpreter cache holds stale Python version info on Windows, causing rye sync to fail after version bump

Author: brandon-springerCreated Aug 1, 2025Updated Aug 6, 2025

Steps to Reproduce

Steps to Reproduce

  1. On Windows, create a Rye project with Python 3.11.8 (or let it default to 3.11.8 initially)
  2. Later, change project’s Python version to 3.13.1:

Update pyproject.toml: requires-python = "==3.13.1" Update .python-version: 3.13.1 (Possibly optional) Delete .venv

  1. Run rye sync
  2. Rye uses the correct Python version (3.13.1) and creates a fresh .venv
  3. Despite this, rye sync fails because uv reports the active Python as 3.11.8 Because the current Python version (3.11.8) does not satisfy Python==3.13.1 ...
  4. Manually verifying .venv\Scripts\python.exe shows the correct version (3.13.1)
  5. The issue is resolved only after manually deleting UV’s interpreter cache: Remove-Item -Recurse -Force $env:LOCALAPPDATA\\\uv\cache

Expected Result

  • UV should revalidate the actual Python version in .venv, not rely on stale cached metadata

Rye should either:

  • Invalidate the interpreter cache automatically when .venv is recreated
  • Or surface a warning when version mismatch is detected between .venv and UV's internal assumptions

I'm primarily filing this as a rye bug as I was using rye as this occurred, and it seems like the value of using uv under the hood is very high, but this feels like I fell through a gap between them that shouldn't have felt so gnarly.

Actual Result

Actual Result

  • UV uses cached metadata and misidentifies the Python version inside .venv as 3.11.8
  • Dependency resolution fails despite .venv being correct
  • The only way to recover is to delete UV’s cache manually
  • Not reproducible on macOS — only seen on Windows

A selection of logs when running rye sync --verbose:

rye sync --verbose
Python version already downloaded. Skipping. Initializing new virtualenv in C:\Users\\user\project-name.venv Python version: [email protected] Using CPython 3.13.1 interpreter at: C:\Users\\user.rye\py\[email protected]\python.exe Creating virtual environment at: .venv Activate with: .venv\Scripts\activate Generating production lockfile: C:\Users\\user\project-name\requirements.lock ...... Installing dependencies DEBUG uv 0.6.3 (a0b9f22a2 2025-02-24) DEBUG Searching for default Python interpreter in virtual environments DEBUG Found cpython-3.11.8-windows-x86_64-none at C:\Users\\\user\project-name\.venv\Scripts\python.exe (active virtual environment) DEBUG Using Python 3.11.8 environment at: .venv DEBUG Acquired lock for .venv DEBUG Using request timeout of 30s DEBUG Found PEP 621 metadata for C:\Users\\user\project-name in pyproject.toml (project-name) DEBUG Solving with installed Python version: 3.11.8 DEBUG Solving with target Python version: >=3.11.8 ...... DEBUG No workspace root found, using project root DEBUG Found fresh response for: https://pypi.org/simple/ruff/ DEBUG No compatible version found for: Python DEBUG Recording unit propagation conflict of Python from incompatibility of (project-name) DEBUG Searching for a compatible version of project-name @ file:///C:/Users/user/project-name (<0.1.0 | >0.1.0) DEBUG No compatible version found for: project-name DEBUG Released lock at C:\Users\\\user\AppData\Local\\\uv\cache\simple-v15\index\b2a7eb67d4c26b82\ruff.lock DEBUG Found fresh response for: https://pypi.org/simple/pydantic-core/ DEBUG Released lock at C:\Users\\\user\AppData\Local\\\uv\cache\simple-v15\index\b2a7eb67d4c26b82\pydantic-core.lock DEBUG Released lock at C:\Users\\\user\AppData\Local\\\uv\cache\simple-v15\index\b2a7eb67d4c26b82\pydantic-core.lock x No solution found when resolving dependencies: -> Because the current Python version (3.11.8) does not satisfy Python==3.13.1 and project-name==0.1.0 depends on Python==3.13.1, we can conclude that project-name==0.1.0 cannot be used. And because only project-name==0.1.0 is available and you require project-name, we can conclude that your requirements are unsatisfiable. DEBUG Released lock at C:\Users\\user\project-name.venv.lock` error: Installation of dependencies failed in venv at C:\Users\\user\project-name.venv. uv exited with status: exit code: 1

..venv\Scripts\python.exe --version Python 3.13.1

Version Info

rye 0.44.0 commit: 0.44.0 (e21393834 2025-02-26) platform: windows (x86_64) self-python: [email protected] symlink support: true uv enabled: true

Stacktrace

No response