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

Python can't be run via shim, opens Microsoft Store, after clean install 0.15.2 on Windows 11 x64 #480

Closed
iki opened this issue Oct 18, 2023 · 7 comments · Fixed by #486
Closed
Labels
enhancement New feature or request

Comments

@iki
Copy link

iki commented Oct 18, 2023

Steps to Reproduce

  1. install rye 0.15.2 rye-x86_64-windows.exe
  2. run %UserProfile%\.rye\shims\python.exe

Expected Result

Python 3.11.6 is executed from %UserProfile%\.rye\py\cpython@3.11.6\install\python.exe

Actual Result

No output on console, Microsoft Store opens.

Notes:

  • Python.exe can be run from %UserProfile%\.rye\py\cpython@3.11.6\install\python.exe successfully.
  • However, Is it correct location, where rye expects it? I saw ..\bin\python.exe in comments in other issues here. Imo that should be documented.
  • Setup passed ok, I tried it twice (on first attempt, Windows returned classic localized message that Python can't be found)
C:\Users\iki\Downloads\.dev>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\iki\.rye
This path can be changed by exporting the RYE_HOME environment variable.

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

Continue? yes
Installed binary to C:\Users\iki\.rye\shims\rye.exe
Bootstrapping rye internals
Downloading cpython@3.11.6
Checking checksum
success: Downloaded cpython@3.11.6
Upgrading pip
Installing internal dependencies
Updated self-python installation at C:\Users\iki\.rye\self

Note: You need to manually add %USERPROFILE%\.rye to your PATH.
For more information read https://mitsuhiko.github.io/rye/guide/installation

All done!
Press any key to continue

Version Info

C:\Users\iki\.rye\py\cpython@3.11.6>rye --version
rye 0.15.2
commit: 0.15.2 (e2beb3a90 2023-10-04)
platform: windows (x86_64)
self-python: cpython@3.11
symlink support: true

C:\Users\iki\.rye\py\cpython@3.11.6>ver
Microsoft Windows [Version 10.0.22635.2483]

Stacktrace

No response

@iki
Copy link
Author

iki commented Oct 18, 2023

Thanks for a great tool @mitsuhiko! I'm available for any testing

@iki
Copy link
Author

iki commented Oct 18, 2023

Strange it works after closing and reopening terminal, even when the env path is unchanged and I tried to run python.exe directly in the shims directory (and with shims path explicitly).

Closing for now, will reopen if it happens again and will be more clear, that there's something to fix

@iki iki closed this as completed Oct 18, 2023
@iki
Copy link
Author

iki commented Oct 18, 2023

Strange it works after closing and reopening terminal, even when the env path is unchanged and I tried to run python.exe directly in the shims directory (and with shims path explicitly).

Closing for now, will reopen if it happens again and will be more clear, that there's something to fix

@iki
Copy link
Author

iki commented Oct 25, 2023

Resolution of the above issue:

  • The python.exe that opens Microsoft Store is a Microsoft shim in %UserProfile%\AppData\Local\Microsoft\WindowsApps, which is next python in PATH after %UserProfile%\.rye\shims
  • Rye shim apparently runs the next python in PATH when launched outside of any project and global shim is not enabled via rye config --set-bool behavior.global-python=true

@mitsuhiko
Copy link
Collaborator

I wonder if I could detect the windows store version. You probably never want to bring up the store and I could instead of falling back to that print out a helpful error.

@mitsuhiko mitsuhiko added the enhancement New feature or request label Oct 26, 2023
@mitsuhiko mitsuhiko reopened this Oct 26, 2023
@iki
Copy link
Author

iki commented Oct 26, 2023

@mitsuhiko good idea.

It can be detected by checking if the next python in PATH is %UserProfile%\AppData\Local\Microsoft\WindowsApp\python.exe

Actually if there's no global python installed, then global.python should be forced true IMO, because user simply wants to run python. Optionally, the setting could be renamed to override.global.python to make the logic apparent: if false, it will prefer the existing global python in PATH, if any. WDYT?

@mitsuhiko
Copy link
Collaborator

It can be detected by checking if the next python in PATH is %UserProfile%\AppData\Local\Microsoft\WindowsApp\python.exe

Not entirely because that executable turns into the actual shim executable when python has been successfully installed from the store.

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

Successfully merging a pull request may close this issue.

2 participants