there is a bug in cx_Freeze with the multiprocessing package where it copies the "pool.pyc" as "Pool.pyc" which results in a runtime error: "no module named multiprocessing.pool".
To mitigate this, I wanted to include a VBScript with my installer to rename that file post-installation to keep my build process automatic.
I tried this:
msi_custom_action = [
(
'rename_pool', # identifier
22, # custom action type, https://learn.microsoft.com/en-us/windows/win32/msi/custom-action-type-22
'installer_helper.vb', # source
None, # target
None, # extendedtype
)
]
msi_sequence = [
(
'rename_pool', # name of action
None, # condition
6601, # sequence (6600< after files are copied)
)
]
msi_data = {
"Shortcut": msi_shortcut_table,
"CustomAction": msi_custom_action,
"InstallExecuteSequence": msi_sequence,
}
options = {
'build_exe': {
'optimize': 1,
'includes': ['atexit'],
'include_files': [('./qt/', 'qt/'), './TableManipulationsDialogOperations.json', './single.rc', './matplotlibrc', './installer_helper.vb'],
'packages': packages,
'excludes': ['scipy.spatial.cKDTree', 'tkinter', 'Tkinter'], # cKDTree excluded bc of a bug, ckdtree still available
},
'bdist_msi': { # first three options remove need of admin rights for installer
'initial_target_dir': r'[LocalAppDataFolder]\spleng',
'add_to_path': False,
'all_users': False,
'data': msi_data,
'target_name': 'Spleng_Installer',
}
}
# execute build
setup(
name="SplENG",
options=options,
version='0.1.1',
description='SplitExplorerNextGeneration',
executables=executables
)
But while creating the installer, I receive this error:
creating dist
Traceback (most recent call last):
File "build.py", line 146, in <module>
executables=executables
File "C:\Users\-\Documents\git_repos\spleng\.venv\lib\site-packages\cx_Freeze\dist.py", line 340, in setup
distutils.core.setup(**attrs)
File "C:\Users\-\AppData\Local\Programs\Python\Python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\-\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\-\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\-\Documents\git_repos\spleng\.venv\lib\site-packages\cx_Freeze\windist.py", line 420, in run
self.add_config(fullname)
File "C:\Users\-\Documents\git_repos\spleng\.venv\lib\site-packages\cx_Freeze\windist.py", line 74, in add_config
msilib.add_data(self.db, tableName, data)
File "C:\Users\-\AppData\Local\Programs\Python\Python37\lib\msilib\__init__.py", line 104, in add_data
assert len(value) == count, value
AssertionError: ('rename_pool', 22, 'installer_helper.vb', None, None)
Can someone tell me how to properly add the script, I can't really make heads or tails with the docs. I'm using cx_freeze version 6.1.
This whole problem can be avoided by adding 'multiprocessing.Pool' to the excludes in the setup.py.