Skip to content

python.exe and other aliases not working before reinstalling the manager #370

Open

Description

@R4ygen

Install source and version

  • Installed from the Windows Store
  • Installed with the MSIX from python.org
  • Installed with the MSI from python.org
  • Installed with winget install 9NQ7512CXL7T

Version: 26.2.240.0

Describe the bug
I was trying to start python via the "python" command, instead of the "py" command. But it was not working.
Powershell kept giving me this error:

Program 'python.exe' failed to run: The system cannot find the path specifiedAt line:1 char:1
+ python
+ ~~~~~~.
At line:1 char:1
+ python
+ ~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

The "py" command on the other hand was working like a charm.

I've tried to:

  1. Refresh the python install with py install --refresh
  2. Unchecked and re-checked all python aliases in Windows' "Manage app execution aliases" settings.
  3. Re-configure the python installation with py install --configure
  4. Force re-installing python with py install -f default

Nothing was working. And %UserProfile%\AppData\Local\Microsoft\WindowsApps was correctly in the PATH.
So I've tried to launch the python.exe directly present in the WindowsApps folder: Nope, same issue.

At that point, since it was an issue with the Windows app, I thought I'd try to reinstall the Python Install Manager itself from the Store. And that fixed it!

No idea what was wrong with the .exe link inside the WindowsApps folder. But this error, and this fix (reinstalling the manger itself) are not present in the troubleshooting steps in the online docs. So I'm reporting this in case another user finds itself in this same pickle, and, to perhaps include "reinstall the manger" as an additional troubleshooting step in the online docs?

To Reproduce
No idea.
I'm glad to provide log files. But dunno where to find log files related to the WindowsApps .exe files.

Expected behavior
Implement the fix found, in the troubleshooting steps.

Activity

  1. zooba commented on Jun 16, 2026

    @zooba
    Member

    Hmm, all I can imagine here is that Windows somehow created corrupt shortcuts on the initial install. It's unlikely that anything would show up in the OS logs, as it would clearly be an unintended bug. Unfortunately, there are a few of those floating around in alias management, but they're never reproducible enough to get them fixed.

    If you (or anyone else) would like to make a PR adding the suggestion as a final fallback (it's really not going to do anything more for the most common problems, only the really obscure ones like yours), the file is Doc/using/windows.rst over in https://github.com/python/cpython.

  2. added
    enhancementNew feature or request
    documentationImprovements or additions to documentation
    and removed
    enhancementNew feature or request
    on Jun 16, 2026
  3. Vectorial1024 commented on Jul 8, 2026

    @Vectorial1024

    I recently ran into some problems with my Python installation and had to reinstall the Python Installation Manager. What I found was that PIM installed the py tool and the related files in %UserProfile%\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0, which is clearly not in PATH, and also not the one specified in the setup hint for %UserProfile%\AppData\Local\Python\bin, and py.exe was also not inside %UserProfile%\AppData\Local\Python\bin.

    What this meant was that I got a fresh copy of Python 3.14 (thankfully is usable by prompt "add bin to PATH") but was unable to further configure my Python runtimes using py. The cmd would complain about e.g. "py is not found in this system".

    Adding the long PythonSoftwareFoundation path into the PATH environment variable fixed the issue for me. However, it seems best if PIM can automatically self-inject into PATH. For example, it feels like this py tool should also be copied over to the Python bin path, or at least a symlink should be dropped over to there.

    Not sure if related, but I took this opportunity to migrate my setup from the legacy "Python 3.xx" MS Store items to the now-recommended PIM setup, which also involved e.g. ghost entries of the legacy items that I had to remove by regedit. Apparently both the legacy Python items share the same space with PIM, so trying to uninstall PIM first (which removes the Python uninstaller afterwards) means that the legacy Python items cannot be uninstalled (same uninstaller, but is gone).

  4. zooba commented on Jul 8, 2026

    @zooba
    Member

    Windows should already have %UserProfile%\AppData\Local\Microsoft\WindowsApps on PATH by default, and app execution aliases that are enabled (see "Manage app execution aliases" settings page on your PC) will be put in there.

    Sometimes people remove that directory from PATH. If you do that, Windows will respect your decision, but it means you don't get the commands by default. Put the path back and you'll have them. See the troubleshooting section at https://docs.python.org/using/windows for more info.

    Probably we need to detect when this path is missing from PATH and tell users that they've broken themselves somehow. But it's not our responsibility to put it there - Windows does it by default, and only manual changes will remove it (and if you've manually removed it, we can assume that you know how to manually put it back).

    Not sure if related, but I took this opportunity to migrate my setup from the legacy "Python 3.xx" MS Store items to the now-recommended PIM setup, which also involved e.g. ghost entries of the legacy items that I had to remove by regedit. Apparently both the legacy Python items share the same space with PIM, so trying to uninstall PIM first (which removes the Python uninstaller afterwards) means that the legacy Python items cannot be uninstalled (same uninstaller, but is gone).

    The Store items don't share anything with the install manager other than the WindowsApps entries I mentioned above (they have separate subdirectories for their commands, but when enabled globally will be in the WindowsApps directory together). There are no registry entries you should be touching for Store apps - you will have had to make security changes to your PC, and we can't help you if you've done that.

    Uninstalling the install manager will not affect uninstallers for any other Python runtimes. It will leave broken entries in Add/Remove Programs for anything that it has installed itself, but it doesn't overwrite anything created by a legacy installer. (The legacy installer might overwrite things created by the install manager, however.)

    So while this is concerning, and we don't want the install manager to prevent uninstalls of old runtimes, I don't see anything in your description that makes sense enough to identify a problem. More likely you just encountered bugs in the old installers, which is why we want to get rid of them.

  5. segevfiner commented on Aug 6, 2026

    @segevfiner

    It seems some weird Windows bug on my computer somehow restored the shims in WindowsApps, while the execution aliases were still turned off (Probably the manager automatically turned them off at some point, like during install), so I had to enable and disable them again, in classic Windows restart to fix it philosophy to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions