Open 0532d49d-6933-4fae-96f2-eeb690ed5a3d opened 2 years ago
This issue is related to https://bugs.python.org/issue3561
When installing Python under Windows, if the "Add Python 3.x to PATH" option is flagged, the following two folders are added to the PATH environment variable: %USERPROFILE%\AppData\Local\Programs\Python\Python3x\ %USERPROFILE%\AppData\Local\Programs\Python\Python3x\Scripts\
However also the following folder should be added, which is where scripts reside when packages are installed with "pip install --user": %USERPROFILE%\AppData\Roaming\Python\Python3x\Scripts\
I agree. Otherwise when a user installs packages that have scripts entry points, the user will get confuddled.
Worth noting that if this is added to the MSIs, we then also need to start creating and removing this folder as part of install, we'll need some additional calculations or properties to know where it is located, possibly a few tricks to make sure it gets inserted in the correct order (ahead of the "non-user" directory, which I think means we want to make sure the new one gets added later).
It's probably possible to make it a non-fatal error if we can't remove the folder on uninstall, or if it can't be created on install, and avoid deleting any contents on repair/uninstall. Those might all be the defaults, but we've definitely has installs be aborted and rolled back because of folders, so it's clearly not a guarantee.
We can't do any of this in an all users install, so in that case users will just have to add it manually if they want it.
Alternatively, it might be more robust anyway to replace the entire mechanism with a custom action to do all the PATH manipulation. Windows Installer is already pretty unreliable, and there are plenty of cases of paths not being added or removed (and of course, they never go in the right order). It could probably be done as a Python script, since we can assume we're successfully installed by the time we get to doing it (people uninstalling corrupt installs will probably need to run a repair first, but that's likely required to do the pip uninstall anyway, so it's not an unheard of situation).
I'm not personally interested in investing in the old installers anyway, as I think the MSIX is the way forward, but if someone gets a PR together I'll help get it in.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['type-feature', 'expert-installation', '3.10', 'OS-windows']
title = 'Windows installer should add also "%USERPROFILE%\\AppData\\Roaming\\Python\\Python3x\\Scripts" folder to the PATH environment variable'
updated_at =
user = 'https://github.com/lucatrv'
```
bugs.python.org fields:
```python
activity =
actor = 'lucatrv'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Installation', 'Windows']
creation =
creator = 'lucatrv'
dependencies = []
files = []
hgrepos = []
issue_num = 45968
keywords = []
message_count = 1.0
messages = ['407550']
nosy_count = 5.0
nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'lucatrv']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue45968'
versions = ['Python 3.10']
```