I created a PyQT application that depends on a huge amount of packages and want to deploy it now. The exe file is generated with the use of PyInstaller and onedir mode. When I start the main.exe inside a command prompt no errors are displayed and the applications starts as wanted. The problem is that the startup process takes about 20min what is really annoying. The distribution folder has a size of 1.3 GB. Are there any ways to speed up the startup process or do I have to use an alternative to PyInstaller? My .spec files looks like this:
# -*- mode: python -*-
import glob
import rasterio
import pkgutil
from PyInstaller.utils.hooks import collect_data_files
block_cipher = None
bins = glob.glob(rasterio.__path__[0] + '\\*pyd')
binaries = [(bin,'rasterio') for bin in bins]
additional_packages = list()
for package in pkgutil.iter_modules(rasterio.__path__, prefix="rasterio."):
additional_packages.append(package.name)
datas = collect_data_files('geopandas',subdir = 'datasets')
datas.append(('C:\\User\\FalterR\\Desktop\\AutoSeg 945\\tool_autoseg\\classifier\\runtime_regression.joblib','clf'))
datas.append(('C:\\User\\FalterR\\Desktop\\AutoSeg 945\\tool_autoseg\\data\\runtime_logfile.csv','csv'))
datas.append(('C:\\User\\FalterR\\Desktop\\AutoSeg 945\\tool_autoseg\\view\\logo_rc.py','.'))
a = Analysis(['main.py'],
pathex=['C:\\User\\FalterR\\Desktop\\AutoSeg 945'],
binaries=binaries,
datas=collect_data_files('geopandas',subdir='datasets'),
hiddenimports=additional_packages,
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=True,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='main')
- I already changed all imports inside my code, so only the neccessary functions are used. e.g import pandas as pd --> from pandas import DataFrame
- I tried to setup a new conda environment without any uneccessary packages
- Anti virus protection can not be turned off due to company regulations as suggested in different posts