Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing rye breaks the Windows launcher shebang support #1035

Open
pfmoore opened this issue Apr 23, 2024 · 0 comments
Open

Installing rye breaks the Windows launcher shebang support #1035

pfmoore opened this issue Apr 23, 2024 · 0 comments

Comments

@pfmoore
Copy link

pfmoore commented Apr 23, 2024

Steps to Reproduce

❯ type .\example.py
#!/usr/bin/env python
import sys

print(sys.executable)
❯ py example.py
C:\Users\Gustav\AppData\Local\Programs\Python\Python312\python.exe
❯ .\rye-x86_64-windows.exe
Welcome to Rye!

Rye has detected that it's not installed on this computer yet and
automatically started the installer for you. For more information
read https://rye-up.com/guide/installation/

This installer will install rye to C:\Users\Gustav\.rye
This path can be changed by exporting the RYE_HOME environment variable.

Details:
  Rye Version: 0.32.0
  Platform: windows (x86_64)

✔ Continue? · yes
✔ What should running `python` or `python3` do when you are not inside a Rye managed project? · Run the old default Python (provided by your OS, pyenv, etc.)
Installed binary to C:\Users\Gustav\.rye\shims\rye.exe
Bootstrapping rye internals
Downloading cpython@3.12.2
Checking checksum
Unpacking
Downloaded cpython@3.12.2
Updated self-python installation at C:\Users\Gustav\.rye\self

All done!
Press any key to continue
❯ py .\example.py
error: Target Python binary 'python.exe' not found.
You are currently outside of a project. To resolve this, consider enabling global shims. Global shims allow for a Rye-managed Python installation.
For more information: https://rye-up.com/guide/shims/#global-shims

Note that I explicitly requested Rye to "Run the old default Python", by which I mean "don't change any behaviour outside of a Rye-managed project". This is clearly not what has happened.

It's also worth noting that I don't actually have a python executable installed on my PATH in my normal setup, I use the py interpreter exclusively to locate and run Python. The /usr/bin/env python shebang is interpreted by the py launcher to mean "run my default Python".

Expected Result

The script runs the same as it did before I installed Rye, printing my global Python (the one py -c "import sys; print(sys.executable)" would report).

Actual Result

An error from the new Rye shim for Python:

error: Target Python binary 'python.exe' not found.
You are currently outside of a project. To resolve this, consider enabling global shims. Global shims allow for a Rye-managed Python installation.
For more information: https://rye-up.com/guide/shims/#global-shims

Version Info

❯ rye --version
rye 0.32.0
commit: 0.32.0 (e1b4f2a29 2024-03-29)
platform: windows (x86_64)
self-python: cpython@3.12.2
symlink support: true
uv enabled: true

Stacktrace

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant