astral-sh / rye

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

`unknown version` when bootstrapping Rye #1430

Open Timmmm opened 1 week ago

Timmmm commented 1 week ago

Steps to Reproduce

nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs
nix-channel --update
nix-shell -p rye --command "rye test"

Expected Result

It works.

Actual Result

Bootstrapping rye internals
Downloading cpython@3.12.3
Checking checksum
Unpacking
Downloaded cpython@3.12.3
error: failed fetching toolchain ahead of sync
Caused by:
    unknown version cpython-x86_64-linux@3.12.4

Version Info

rye 0.34.0
commit: 0.34.0 (1980-01-01)
platform: linux (x86_64)
self-python: cpython@3.12.3
symlink support: true
uv enabled: true

Stacktrace

error: failed fetching toolchain ahead of sync

Caused by:
    unknown version cpython-x86_64-linux@3.12.4

Stack backtrace:
   0: anyhow::error::<impl anyhow::Error>::msg
   1: rye::bootstrap::fetch
   2: rye::sync::sync
   3: rye::sync::autosync
   4: rye::cli::test::execute
   5: rye::cli::execute
   6: std::panicking::try
   7: rye::utils::panic::trap_bad_pipe
   8: rye::main
   9: std::sys_common::backtrace::__rust_begin_short_backtrace
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try
  12: std::rt::lang_start_internal
  13: main
  14: __libc_start_call_main
  15: __libc_start_main@@GLIBC_2.34
  16: _start
Timmmm commented 1 week ago

Note, this works on my relatively normal RHEL8 laptop. The above is from a HPC server which has weird TCL modules and stuff. But even so it should work!

Timmmm commented 1 week ago

Ah it's because I have .python-version that contains 3.12.4, and that version of Python was released after the version of Rye I'm using.

I think this could be improved in at least two ways:

  1. The error message could be improved. Add something like This version of Rye is from 2024-06-02 and does not know about Python versions released after that. Note that the date in --version is incorrect though so maybe don't rely on that.
  2. Ideally it should work with versions of Python released after it was released. It can download a dynamic list of versions from a server somewhere. That is a ton more work though and requires setting up a server, so I'd just go with a better error message for now.