rye icon indicating copy to clipboard operation
rye copied to clipboard

Opaque "Unable to determine target virtualenv Python version" running `rye sync` in `ruff` repo

Open carljm opened this issue 10 months ago • 1 comments

Steps to Reproduce

  1. I have [email protected] toolchain (only) installed in rye
  2. git clone [email protected]:astral-sh/ruff && cd ruff
  3. rye sync

Expected Result

I expected rye sync to create a 3.12.2 env (but perhaps this was a wrong expectation? new rye user), or else to fetch some other version and create a virtualenv with that

Actual Result

error: Unable to determine target virtualenv Python version

This error doesn't offer much to go on in debugging the issue. What versions did Rye consider? Why did it reject them? What can I do to fix the issue? I looked for an option to rye sync to specify the python version and didn't find one. Eventually I found a reference to .python-version and echo "3.12.2" > .python-version fixed the issue.

@zanieb pointed out that the error is coming from here: https://github.com/astral-sh/rye/blob/ebd947dbc67b9950a3a65571caca86c881a5d347/rye/src/pyproject.rs#L1153-L1178

Version Info

➜ rye --version
rye 0.31.0
commit: 0.31.0 (72e239b8f 2024-03-22)
platform: macos (aarch64)
self-python: [email protected]
symlink support: true
uv enabled: true

Stacktrace

No response

carljm avatar Apr 02 '24 23:04 carljm

use rye pin [email protected] instead of echo "3.12.2" > .python-version

phi-friday avatar Apr 04 '24 03:04 phi-friday