Reputation: 423
I have a program that I need to distribute as an exe to my team (they need to have different versions of python as dependencies for other things). Initially, I had everything in onefile and used the --onefile argument, and it was working fine. But to better organize the code, I moved to multiple files. After adjusting some relative path issues from now running the exe inside a sub_dir in the main program dir, it is still executing without any issues. However, once I zip the program directory to send to my team, if I try to unzip it, Windows basically slows to a crawl. Eventually, task bar even disappears. Moving it also takes surprising long. It's only 40 MB, but tons of files. 2,586 Files, 281 Folders per Windows properties.
My dependencies list has also increased considerably, so that's probably relevant:
>altgraph==0.17
>autopep8==1.5.5
>backcall==0.2.0
>cachetools==4.2.1
>codetiming==1.3.0
>colorama==0.4.4
>decorator==4.4.2
>et-xmlfile==1.0.1
>future==0.18.2
>ipykernel==5.5.0
>ipython==7.21.0
>ipython-genutils==0.2.0
>jedi==0.18.0
>jupyter-client==6.1.12
>jupyter-core==4.7.1
>openpyxl==3.0.7
>parso==0.8.1
>pefile==2019.4.18
>pickleshare==0.7.5
>prompt-toolkit==3.0.17
>py2exe==0.10.3.0
>pycodestyle==2.6.0
>Pygments==2.8.1
>pyinstaller==4.2
>pyinstaller-hooks-contrib==2021.1
>python-dateutil==2.8.1
>pywin32==300
>pywin32-ctypes==0.2.0
>PyYAML==5.4.1
>pyzmq==22.0.3
>six==1.15.0
>toml==0.10.2
>tornado==6.1
>tqdm==4.59.0
>traitlets==5.0.5
>wcwidth==0.2.5
>XlsxWriter==1.3.7
The first thing I'll try tomorrow is to uninstall ipython from the venv since i only need that for VS code interactive shell debugging. But other than that, any ideas why this could be happening?
Upvotes: 1
Views: 303
Reputation: 423
Yes, turns out I was correct. I uninstalled the following packages (using pip uninstall after activating the venv):
ipykernel ipython ipython-genutils jupyter-client jupyter-core codetiming (codetiming is probably unrelated, but I'm not using it anymore)
The package went from about 40mb to 23 MB, and from around 2500 files to 42. Now there's no delay in zipping, unzipping, moving etc.
Maybe the issue was that the kernel was running while building, and some cache was getting copied or something? Or ipython and pyinstaller are just incompatible?
But I think the more general moral of the story is to be more deliberate about separating the development sandbox environment from the production environment when building something to be distributed.
Upvotes: 1