Page 1 of 1

[SOLVED] version in registry does not match requirements of min_version

Published: January 3, 2024 - 1:54 PM
by cefinformatique
Good morning,

I created a package to deploy software (already installed on client machines) version 23.1.0.4

Here is the setup.py file for my package:

Code: Select all

def install():
    softname ='AWCLIENTSQL'
    listAW=installed_softwares(softname)
    if listAW == softname:
        print("Mise a jour de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key='AWCLIENTSQL',
            remove_old_version=True
        )
    else:
        print("Mise a jour de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key='AWCLIENTSQL'
        )
        filecopyto(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ACDSuite\DiaClient SQL.lnk',r'C:\Users\Public\Desktop')
Once the package is deployed, I get the following error in 80% of cases:
waptutils.EWaptSetupException: Fatal error: Setup DiaClientSQLInstall.exe has been executed and key AWCLIENTSQL has been found in the registry, but version in registry does not match requirements of min_version=23.1.0.4

EWaptSetupException: Fatal error: Setup DiaClientSQLInstall.exe has been executed and key AWCLIENTSQL has been found in the registry, but version in registry does not match requirements of min_version=23.1.0.4
If I manually restart the update, it will eventually apply correctly after several attempts.

The version installed before the update via WAPT was 23.1.0.2

What can I do to avoid this problem?

Re: version in registry does not match requirements of min_version

Published: January 3, 2024 - 3:24 PM
by sfonteneau
No min_version argument is passed to install_exe_if_needed

So the function does this:

Code: Select all

if min_version is None:
    min_version = get_product_props(exe)['version']
And retrieves the version number specified in the file properties.

In your case, it probably isn't good

The best approach would be to add a min_version argument with the version number associated with the AWCLIENTSQL key

Re: version in registry does not match requirements of min_version

Published: February 13, 2024 - 1:36 PM
by cefinformatique
Hello,

I'm reopening this topic because, during a recent software update, I correctly entered the "min_version" value, but this didn't resolve the issue.

I've found the cause: During program installation, the old version isn't uninstalled. Because the installation returns an error code of 0 before updating the version number in the Windows registry, the WAPT package compares its version number with the old number still stored in the registry.

Therefore, I need to make the WAPT package wait (approximately 20 seconds) at the stage between the end of the installation and the version number check in the registry to resolve this problem.

Is this possible?

Re: version in registry does not match requirements of min_version

Published: February 14, 2024 - 2:34 PM
by cefinformatique
I solved my problem by using the WinReg module to delete the software's registry key before installation. It's a bit of a hack, but it works!

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import winreg

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
uninstallkey = ['AWCLIENTSQL']

def install():
    killalltasks(control.get_impacted_process_list())
    softname ='AWCLIENTSQL'
    listFULL=installed_softwares(softname)
    listAW=listFULL[0]['key']
    if listAW == softname:
        # Define the registry key path
        key_path = r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
        # Open the registry key for deletion
        try:
            with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, key_path, 0, winreg.KEY_ALL_ACCESS) as registry_key:
                winreg.DeleteKey(registry_key, "AWCLIENTSQL")
                print("Registry key deleted successfully.")
        except FileNotFoundError:
            print("Registry key not found.")
        except PermissionError:
            print("Permission error. Run the script with administrative privileges.")
        except Exception as e:
            print(f"An error occurred: {e}")
        print("Mise a jour de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key=softname,
            remove_old_version=True,
#            min_version=control.get_version()
        )
    else:
        print("Installation de DiaClientSQL")
        install_exe_if_needed('DiaClientSQLInstall.exe',
            silentflags='/Silent',
            key=softname,
            remove_old_version=True
        )
        filecopyto(r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ACDSuite\DiaClient SQL.lnk',r'C:\Users\Public\Desktop')

Re: [SOLVED] version in registry does not match requirements of min_version

Published: February 15, 2024 - 4:25 PM
by dcardon
Hi Marc,

thanks for the feedback!

Denis