I have developed the UI using the PyQt5, now i am converting the code into standalone application using Pyinstaller, but the problem is the file size is coming huge (nearly 250MB). Can i reduce the size of my file but excluding the unnecessary imports of PyQt5. Following the libraries i have used -
from PyQt5 import QtCore, QtGui, QtWidgets
import tkinter as tk
from tkinter import filedialog
from tkinter import messagebox
import os,sys
from mat4py import loadmat
from matplotlib import pyplot as plt
PyQt5 library has following many sub modules (QtCore, QtGui, QtWidgets, QtMultimedia, QtBluetooth, QtNetwork, QtPositioning, Enginio, QtWebSockets, QtWebKit, QtWebKitWidgets, QtXml, QtSvg, QtSql, QtTest) in which i am using only QtCore, QtGui and QtWidgets.
Similarly, library matplotlib many modules in which i am using pyplot.
I want to skip the modules which the program doesn't using, so that i can reduce the size of the executable file.
My Spec file of pyinstaller -
import sys
sys.setrecursionlimit(3000)
block_cipher = None
a = Analysis(['ReadMAT.py'],
pathex=['C:\\Users\\Sekhar\\Documents\\PythonScripts\\RXP\\ReadMAT'],
binaries=[],
datas=[],
hiddenimports=[],
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,
a.binaries,
a.zipfiles,
a.datas,
[],
name='ReadMAT',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False, icon='ReadMAT.ico')
How to skip the submodules which will not get into the compilation process. How can i reduce the file size of the executable ?