Skip to content

bug: minor versions update instead of install, even if previous versions were uninstalled; this messes up pyenv versioning #401

Closed

Description

@zEdS15B3GCwq

Describe the bug
Installation of a new patch (e.g. 3.9.x) version of Python results in an update instead of a new installation, which messes up version numbers in pyenv-win and makes it impossible to uninstall.

I believe, the main issue is that recent Python installers are smarter and detect other installed versions, or previously installed versions as pyenv uninstall doesn't seem to do a clean job. This means that pyenv install will offer an update instead of a quiet installation.

Problems:

  1. Pyenv doesn't do clean uninstalls of previous versions (registry entry left behind?)
  2. Pyenv doesn't seem know how to install minor version in parallel (override update mechanism)

To Reproduce
Steps to reproduce the behavior:

  1. Install Python 3.9.12 pyenv install 3.9.12
  2. (optional) uninstall same pyenv uninstall 3.9.12
  3. install new minor version pyenv install 3.9.13
  4. Problem: Python installer UI appears and asks if it should update previous installation, even though it's already uninstalled. Proceed, and Python is installed into the previous version's folder (in this case 3.9.12 under pyenv versions). python command correctly launches 3.9.13, but pyenv version(s) will show 3.9.12 as installed. Trying to uninstall 3.9.13 or 3.9.12 fails because pyenv is mistaken about the version, and consequent re-installs still just install 3.9.13 again into 3.9.12's folder. pyenv global 3.9.13 also fails as pyenv thinks 3.9.12 is installed.

Another example:

  1. pyenv install 3.9.13
  2. pyenv uninstall 3.9.13
  3. Run pyenv install 3.9.13 again OR python installer python-3.9.13-amd64.exe. The UI will pop up, offering to modify, repair or uninstall the existing installation. This shows that pyenv uninstall doens't do a clean job. However, choosing uninstall in the UI will result in an error saying no installation detected.

This situation can be corrected by installing through pyenv install, then uninstalling with the installer .exe file.

Expected behavior

  • I expect pyenv to correctly uninstall previous versions, so that new versions don't try to upgrade (especially not in the wrong folder!)
  • I expect pyenv to be able to install 2 minor versions at the same time (block update, install separately)
  • I expect pyenv not to be mistaken about the versions installed
  • I expect silent installs (same as bug: pyenv install is launching a UI window, when it should be a silent install #396) pyenv install -q works

Ideas for a solution

Python versions have a relevant entry under Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall that are left behind even after pyenv uninstall. After removing the entry for 3.9.12, 3.9.13 didn't offer an update anymore. The python installer .exe also removes the registry entry after an uninstall.

Regarding how to override the update mechanism to create parallel minor version installs, maybe hiding the presence of other versions by removing the same relevant registry entries would do the trick? This might be OK if uninstallation can work without the registry entry.

Desktop (please complete the following information):

  • OS: Win 11 x64
  • Tools used: command prompt
  • Version: pyenv 3.7.4 (git pull'ed today's master)

Activity

  1. changed the title [-]bug:[/-] [+]bug: minor versions update instead of install, even if previous versions were uninstalled; this messes up pyenv versioning[/+] on Jun 23, 2022
  2. zEdS15B3GCwq commented on Jun 23, 2022

    @zEdS15B3GCwq
    Author

    Do I understand the code correctly that pyenv uninstall merely deletes the installation folder? If so, it's no wonder that the installer detects previously present installations of the same minor version. It might be better to invoke the installer .exe with the /uninstall flag - that removes the folder and cleans up other traces.

    I haven't been able to figure out a way for parallel installs of patch versions (e.g. 3.9.12 and 3.9.13). The installer always detects that another version is present (e.g. installing 3.9.12 after 3.9.13 fails due to a newer version being already installed). I've tried deleting relevant registry keys at following places, with no success:

    • Computer\HKEY_CURRENT_USER\SOFTWARE\Classes\Installer\Dependencies
    • Computer\HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.9
    • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-21-1056185047-
    • 865165878-1673730577-1006\Products
    • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
    • Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

    Also had a quick peek at a process monitor trace showing registry and file accesses of python-3.9.12-amd64.exe, but nothing popped out as a possible target.

  3. TakiGuan commented on Jul 16, 2022

    @TakiGuan

    I found the same issue when I installed 3.10.4, when I wanted to install 3.10.5, it automatically installed to the folder 3.10.4. So the python version is 3.10.5 and the pyenv version is still 3.10.4. When I manually uninstall 3.10.5 and 3.10.4 both. I installed 3.10.5 and wanted to parallel install 3.10.4 but it failed. The installer detects a new version has been installed. Don't know where the installer finds the new version info.

  4. Darsstar commented on Jul 19, 2022

    @Darsstar
    Collaborator

    It is fixed on the master branch. (see #410) If you want to clean up your PC you should uninstall via WIndow's "Add or remove Programs" system settings page and pyenv uninstall after that. re-installing should now work as you were used to.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions