You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
python.exe and other aliases not working before reinstalling the manager #370
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:
Refresh the python install with py install --refresh
Unchecked and re-checked all python aliases in Windows' "Manage app execution aliases" settings.
Re-configure the python installation with py install --configure
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.
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.
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).
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.
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.
Activity
zooba commentedon Jun 16, 2026
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.rstover in https://github.com/python/cpython.Vectorial1024 commentedon Jul 8, 2026
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
pytool 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, andpy.exewas 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
PythonSoftwareFoundationpath 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 thispytool 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).
zooba commentedon Jul 8, 2026
Windows should already have
%UserProfile%\AppData\Local\Microsoft\WindowsAppsonPATHby 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
PATHand 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).The Store items don't share anything with the install manager other than the
WindowsAppsentries I mentioned above (they have separate subdirectories for their commands, but when enabled globally will be in theWindowsAppsdirectory 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.
segevfiner commentedon Aug 6, 2026
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.