I followed the Pyinstaller doc (https://pyinstaller.readthedocs.io/en/stable/spec-files.html#multipackage-bundles) for a multipackage bundle (calling the MERGE method in the spec file). The build went smooth and, as expected, the second package does not have the shared dependencies... In fact it does not work! :)
Error Loading Python DLL 'path/to/second/pakage/python38.dll' LoadLibrary: the specified module could not be found
If I swap the arguments of the MERGE call, is the first package that is not working, so they are not sharing dependencies.
Here my spec on Pyinstaller 4.3:
block_cipher = None
files_D = [('src_D-QSAR/static/*.*', 'static'),
('src_D-QSAR/templates/*.*', 'templates'),
]
files_Q = [ ('src_QSARpy/pics/*.*', 'pics') ]
OB_libs = [('src_QSARpy/OB_libs/*.dll', '.'),
('src_QSARpy/OB_libs/*.obf', '.'),
]
DQSAR_a = Analysis(['src_D-QSAR/D-QSAR.py'],
pathex=[],
binaries=[],
datas=files_D,
hiddenimports=[],
hookspath=['.'], # add local hooks
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
QSARpy_a = Analysis(['src_QSARpy/QSARpy_GUI.py'],
pathex=[],
binaries=OB_libs,
datas=files_Q,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
MERGE( (QSARpy_a, 'QSARpy_GUI', 'QSARpy2'), (DQSAR_a, 'D-QSAR', 'D-QSAR'), )
DQSAR_pyz = PYZ(DQSAR_a.pure,
DQSAR_a.zipped_data,
cipher=block_cipher)
DQSAR_exe = EXE(DQSAR_pyz,
DQSAR_a.scripts,
[],
exclude_binaries=True,
name='D-QSAR', # .exe
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
icon='src_D-QSAR/static/D-QSAR.ico', )
DQSAR_coll = COLLECT(DQSAR_exe,
DQSAR_a.binaries,
DQSAR_a.zipfiles,
DQSAR_a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='D-QSAR_pyinstaller') # directory
QSARpy_pyz = PYZ(QSARpy_a.pure,
QSARpy_a.zipped_data,
cipher=block_cipher)
QSARpy_exe = EXE(QSARpy_pyz,
QSARpy_a.scripts,
[],
exclude_binaries=True,
name='QSARpy2',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
icon='src_QSARpy/pics/QSARpy.ico', )
QSARpy_coll = COLLECT(QSARpy_exe,
QSARpy_a.binaries,
QSARpy_a.zipfiles,
QSARpy_a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='QSARpy2_pyinstaller')