I am looking for a way to reduce unnecessary modules from a script that uses pandas and that is converted to an exe
file with pyinstaller
.
The script uses the following imports:
from pandas import read_excel
from os import chdir, makedirs
from os.path import isfile, abspath, join, isdir, dirname
from glob import glob
from pathlib import Path as P
import argparse
So, basically "all I need" from pandas is to read an Excel file and to export it into another Excel file and CSV file. The file blows up to around 200MB, mainly due to Pandas. Pandas again needs xlrd
and openpyxl
to process the Excel files.
It is possible to exclude modules from the file that are not required by running e.g.:
pyinstaller --onefile --exclude matplotlib --exclude scipy --exclude numpy.py script.py
I wonder what else I could remove to make the resulting file smaller? Are there any further big modules that I could exclude to produce a minimal Excel converter?
I am using Pandas because it is convenient. One option I guess would be to not use it but to use openpyxl
and csv
instead.