Flow-Launcher / Flow.Launcher

:mag: Quick file search & app launcher for Windows with community-made plugins
https://flowlauncher.com
MIT License
8.21k stars 317 forks source link

BUG: FlowLauncher doesn't recognize Python if installed via MS Store #1951

Open tdnzr opened 1 year ago

tdnzr commented 1 year ago

Checks

Problem Description

I installed Python 3.11 on Windows 11 via MS Store, then tried to add it to my Python Path in Flow Launcher; several attempts caused errors, until I finally found a workaround.

To Reproduce

  1. In General -> Python Path, try to choose a folder via Select
  2. Navigate to the folder C:\Users\<user>\AppData\Local\Microsoft\WindowsApps, then select pythonw.exe
  3. Error: "pythonw The file cannot be accessed by the system."

Alternatively:

  1. In General -> Python Path, try to choose a folder via Select
  2. Navigate to the folder \Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.752.0_x64__qbz5n2kfra8p0\, then select pythonw.exe
  3. Close and restart Flow Launcher
  4. Try to use a plugin based on Python -> Flow Launcher throws an error message indicating it thinks that the error lies with the Python plugin, rather than Flow Launcher itself. But the error itself is just an Access Denied error: "Flow.Launcher.Core.ExternalPlugins.FlowPluginException: An error occurred trying to start process 'C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.752.0_x64__qbz5n2kfra8p0\pythonw.exe'"

Workaround:

  1. In General -> Python Path, manually enter the path C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pythonw.exe
  2. Close and restart Flow Launcher
  3. Try to use a plugin based on Python -> it works

Side note to this workaround: entering the path "%LOCALAPPDATA%\Microsoft\WindowsApps\pythonw.exe" somehow does not work; on restart, Flow Launcher thinks no Python path is set and asks me to set a Python path via the dialog from step 1, which does not work.

Screenshots

No response

Flow Launcher Version

1.14.0

Windows Build Number

10.0.22621.1265

Error Log

No response

tdnzr commented 1 year ago

Related suggestion: MS Store installs Python to a fixed location, so maybe Flow Launcher could automatically query that location and ask whether it should use that installation.

Garulf commented 1 year ago

The way Windows handles Store apps might not make this possible from my experience. I'll keep looking for a solution and would love if anyone more knowledgeable can correct me if I'm wrong.

tdnzr commented 1 year ago

I'm not sure if you're referring to the initial bug report, or to my suggestion in the separate comment. If it's the former, as I mentioned there's a workaround which works just fine, i.e. I'm currently successfully using Python extensions with this MS Store Python installation.

It's just weird how Flow Launcher's Select dialog doesn't accept the same pythonw.exe file which is accepted by manually entering the path C:\Users\<user>\AppData\Local\Microsoft\WindowsApps\pythonw.exe, and separately that the (supposedly identical) path %LOCALAPPDATA%\Microsoft\WindowsApps\pythonw.exe somehow does not work.


By the way, I found this recent Stack Overflow thread to be a good partial overview of the weird way the MS Store package of Python works. And here the Python docs on the Microsoft Store Package list Known Issues of this package.

EDIT: And this Stack Overflow answer (from 2019, so maybe no longer correct) explains why one can't directly select pythonw.exe in "C:\Program Files\WindowsApps", namely due to permissions issues.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 5 days.

tdnzr commented 1 year ago

I don't know how to remove the "stale" label. So here's a comment to indicate that, as far as I can tell, the issue still persists.

VictoriousRaptor commented 1 year ago

I guess that's because path inputbox doesn't respect environment variables.

\AppData\Local\Microsoft\WindowsApps\pythonw.exe

Is it your EXACT input to the input box?

tdnzr commented 1 year ago

Apologies. The path in my original post, albeit not in my comment, was meant to read as <user>\AppData\etc.. But because I didn't mark the text as Code, Github treated the <user> part as a tag and didn't display it. I've edited both. So the full input is C:\Users\<my username>\AppData\Local\Microsoft\WindowsApps\pythonw.exe (which worked when typed, but not when using the Select dialogue) vs. the equivalent %LOCALAPPDATA%\Microsoft\WindowsApps\pythonw.exe (which did not even work when typed).

VictoriousRaptor commented 1 year ago

No need to apologize. I was thinking how could we take a path without a drive.

LOCALAPPDATA is not working because we are not expanding environment variables. It can be fixed.

Related suggestion: MS Store installs Python to a fixed location, so maybe Flow Launcher could automatically query that location and ask whether it should use that installation.

@Garulf is it possible or can we just detect PATH ENV (I guess it's in PATH)? How do we detect python now?

Garulf commented 1 year ago

We don't do any form of automatic detection currently. We only prompt the user if they'd like to have Flow Launcher install embedded Python if a python plugin is detected.

It would be nice to auto detect via path (usually it's in path but not always). This may lead to some broken plugins that rely on Python 3.8 though.