astral-sh / rye

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

`lint` and `fmt` cause os error 2 after upgrade #1316

Closed manzt closed 1 month ago

manzt commented 1 month ago

Steps to Reproduce

I really have a feeling I've messed something up... but I have been scratching my head about this the last two days and maybe I'm missing something.

I ran rye self update and then rye lint and rye fmt now cause the following:

❯ rye fmt
error: No such file or directory (os error 2)

I ran rye self uninstall and then tried reinstalling and the same happend.

  1. install rye via curl -sSf https://rye.astral.sh/get | bash
  2. echo 'source "$HOME/.rye/env"' > ~/.zshrc
  3. rye init testing123 && cd testing123
  4. rye lint (or rye fmt)

Expected Result

Should run ruff fmt and ruff lint

Actual Result

❯ rye fmt
error: No such file or directory (os error 2)

Version Info

rye 0.38.0
commit: 0.38.0 (3e3c8540f 2024-08-02)
platform: macos (aarch64)
self-python: cpython@3.12.4
symlink support: true
uv enabled: true

Stacktrace

No response

manzt commented 1 month ago

Apologies if there isn't enough information here to reproduce, but I'm not sure what other information I could provide that would be relevant.

❯ npx envinfo --system --languages --managers

  System:
    OS: macOS 14.5
    CPU: (14) arm64 Apple M3 Max
    Memory: 2.85 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Managers:
    Cargo: 1.78.0 - ~/.cargo/bin/cargo
    pip3: 21.2.4 - /usr/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Languages:
    Bash: 3.2.57 - /bin/bash
    Perl: 5.34.1 - /usr/bin/perl
    Python: 3.12.4 - /Users/manzt/.rye/shims/python
    Python3: 3.9.6 - /usr/bin/python3
    R: 4.4.1 - /usr/local/bin/R
    Ruby: 2.6.10 - /usr/bin/ruby
    Rust: 1.78.0 - /Users/manzt/.cargo/bin/rustc

Perhaps of note, I get the following error while installing rye:

error: No virtual environment found for executable name `python`

full output

~/demos on  main [!?]
❯ curl -sSf https://rye.astral.sh/get | bash
This script will automatically download and install rye (latest) for you.
######################################################################## 100.0%
Welcome to Rye!

This installer will install rye to /Users/manzt/.rye
This path can be changed by exporting the RYE_HOME environment variable.

Details:
  Rye Version: 0.38.0
  Platform: macos (aarch64)

✔ Continue? · yes
Installed binary to /Users/manzt/.rye/shims/rye
Bootstrapping rye internals
Downloading cpython@3.12.4
Checking checksum
Unpacking
Downloaded cpython@3.12.4
error: No virtual environment found for executable name `python`
error: No virtual environment found for executable name `python`
Updated self-python installation at /Users/manzt/.rye/self

The rye directory /Users/manzt/.rye/shims was not detected on PATH.
It is highly recommended that you add it.
✔ Should the installer add Rye to PATH via .profile? · no
note: did not manipulate the path. To make it work, add this to your .profile manually:

    source "$HOME/.rye/env"

To make it work with zsh, you might need to add this to your .zprofile:

    source "$HOME/.rye/env"

For more information read https://rye.astral.sh/guide/installation/

All done!
manzt commented 1 month ago

now having an issue with upgrading:

❯ rye self update
Updating to latest
Checking checksum
error: Unable to perform update. This can happen because files are in use. Please stop running Python interpreters and retry the update.

Caused by:
    No such file or directory (os error 2)
manzt commented 1 month ago

Ok, I think I sorted this out.

I have UV_PYTHON=python as an environment variable.... but that python comes from Rye, so something happened when upgrading where python is momentarily not available and breaks the rye install (now that rye install is partially bootsrapped with uv?)