r/pythonhelp • • Mar 19 '26

Need to turn a .py into a .exe

Hello, I am trying to turn a .py file into a .exe file with auto-py-to-exe so I can share it with my work colleagues that do not have python. The code is very simple, 30 lines of code and it only import 3 libraries: pandas, pathlib and openserver. It also does not do nothing very complex, it just retrieves data from a software and paste it in and excel, the .py file only weights 2kb.

The problem is that when I use auto-py-to-exe, the resulting exe ends up weighting 308MB, which doesn´t make any sense for me. It works, but a file of that size is absolutely impractical to use and share. It seems as it all the python libraries are loaded into the exe. I tried asking Copilot but it didn´t give me any useful solution.

Do you have any idea on what could be happening and why to fix it so the resulting exe is a light one?

Edit: after using openpyxl instead of pandas, I managed to reduce the size from 300mb to 35 mb, which is impressive. I will keep trying other metods to squiz it even more. Thank you all for your help!

24 Upvotes

84 comments sorted by

View all comments

Show parent comments

1

u/FalconX88 Mar 22 '26

and you paying for it helps you in which way? basically everyone else's email server will reject your email. Allowing more than 50MB is rare, also unnecessary, there much better options available now.

1

u/sububi71 Mar 22 '26

The only times we really send large files over email instead of using DropBox or FTP is when we email internally, and I don't know what the limits are in our system, but if I'm not misremembering, we can at least email stuff in the 50-100MB range.