Make installation process friendly for custom locations (non-admin) on windows

Problem

The installation process of python currently is very non friendly for installing to non default locations in windows. No information is given about the installation process specifics.

The “setup progress” just shows this totally uninformative bar, with no option to “Show more” like in most other installers.

This becomes painful as after installation in custom location, there become just so many locations to keep track of and manually fix: it touches most all things related to installations i can think of:

Directories:

  • %APPDATA%/Python/Python{version}/ : for Scripts and site-packages
  • %LOCALAPPDATA%/ : for Programs/Python, Package Cache, & pip
  • %USERPROFILE%/*.whl : package files

Registry KEYS related to Python under:

  • \SOFTWARE\Microsoft\Windows\CurrentVersion\ : for . and Uninstall
  • \SOFTWARE\Python\PythonCore{version}\PythonPath : under both the HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE

Proposed solutions:

  1. For py launcher: Optionally using .config instead of depending on the .reg (windows registry keys, or say, regedit)
  2. Giving a read logs button in end of Setup progress for successful completions too
  3. Giving “Show more” button on the Setup progress page.
    I would suggest looking at the msys2 installation page - it gives a selectable/copyable output of the installation process
  4. One page mentioning the locations of installation things (& missed) can be given in end. This is a more verbose and more log-like format of what is shown in the other installers at second last page before proceeding to installation.

This will help a lot for rising above from previous corrupted uninstallations as well.

Example of the 4th suggestion point given below:

Python: <install location>
Py launcher: uses <xyz>/.config <or> <xyz> keys in Registry
Scripts & Packages: %APPDATA%/Python/Python{version}/
   ... <put above mentioned paths here> ...

Suggestions:
Add <xyz> in PATH <show this only if not selected while installation>

  • I have 2 users: admin, and personal. I am using personal user.
  • this comment contains data from memory, not verbatim
$ mkdir -p Python/Python 311
    • The root directory of these (hereforth called <ROOTDIR> require admin privileges. Hence, these required the same too.
    • So, i changed the permissions of Python311 (file properties > security > edit) to give the user a write access
    • (don’t know if giving “modify” access too would improve anything)
  • Then i run the python installer > customise >
    • disable “install py for all users (as admin)”
    • disable “install python for all users”
    • enable “add python to environment”
    • change the directory to above specified one
  • This above step properly completes the python installation - with it being listed in the control panel uninstall programs, and with correct path added in environment.
  • The paths added are:
    <ROOTDIR>\Python\Python311\Scripts\;<ROOTDIR>\Python\Python311\;%LOCALAPPDATA%\Programs\Python\Launcher\;
  • optionally move the Launcher folder from above to <ROOTDIR>\Python & change it in the path accordingly
  • relax the permissions of <ROOTDIR>\Python\Python311\Scripts to give write access to user. this should ensure proper functioning of pip

oh, and also, do NOT double click the Python entry in the uninstall programs in the control panel to just check if it’s working well or not, it will directly initiate the uninstaller without any asking. and i don’t think cancelling that midway will do any help.

also, BCUninstaller v5.5 doesn’t detect python uninstaller, so, don’t uninstall it from there either.

for doing pip install jupyter it showed:

$ pip install jupyterlab
   ...
ERROR: Could not install packages due to an OSError: [WinError 5] 
Access is denied: '<DIR>\\Python\\Python311\\etc'
Consider using the `--user` option or check the permissions.

   ... <RERUN AFTER CREATING ETC & REMOVING PERMISSIONS> ...

ERROR: Could not install packages due to an OSError: [WinError 5] 
Access is denied: '<DIR>\\Python\\Python311\\share'
Consider using the `--user` option or check the permissions.

$ pip help install | grep user
  --user                      Install to the Python user install directory for
                              --user, --prefix, --root, and --target.
   ...

so, create these two directories and remove their permissions (i.e. allow users to write/modify - same as above)

mkdir -p Python/Python311/{etc,share}