Search code examples
pythontkinteropenpyxldocxcx-freeze

Why importing openpyxl and docx take so much time in compiled Tkinter?


I'm working on a software using Tkinter, I compiled it using CX_freeze and put it on a server and a lot of users had an abnormal loading time for it.

I added logs and I get HUGE load timesfor openpyxl (127s) and docx (32s), I don't have these results if not compiled on my side and once compiled I do get a 20s load time but not nearly as much as what users can get.

Other libraries load just fine (only Tkinter takes 10s everything else is under 1s), I also get better result on the second start of the software (I suppose it gets memorised somehow).

I import both libraries completely.

How could I reduce this loading time ? I could try importing them when I need them but won't that just postpone the problem ?

I know our company network isn't the best, but this amount of time seems a bit too much.


Solution

  • I got ride of this problem by using pyinstaller instead of cx_freeze now I get normal boot time, still no clue why cx_freeze was behaving like this.