I recently made a small desktop app with Tkinter and created a .exe file with pyinstaller (pyinstaller --onefile -w <file-name>) and had to change some things I was doing in the underlying code to make the .exe file smaller.
At the beginning I was using OpenCV to get some frame information from videos (an overkill, I know), which made the .exe file 400 MB in size, mostly because of the use of pandas. So I changed that to python-ffmpeg. This changed a lot and made the file 16MB. But this is still too big compared to other big program exe files, and takes a couple of seconds to start. I'm working with a conda environment that I created only with Python, and other packages/modules I installed in it are XlsxWriter and docx.
You can reduce the file size for pyinstaller by creating the build in a separate virtual environment.
Execute python -m venv demo_env in your cmd to create a new virtual environment.
After that, install all the packages you need for your script, including pyinstaller.
Once you installed everything again, build the exe as before.
How to make .exe file smaller and faster with pyinstaller (or any other tool)?