Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyInstaller creates slow executable

I'm using PyInstaller to create a single executable of a python program using PyQt. It creates the .exe and runs fine, but takes between 15 to 20 seconds to start. I thought I could get by with creating a splash screen so the user would at least know something was happening, unfortunately, the splash screen doesn't show up any quicker than the program window itself. I also created the same program as -onedir, the program does start quicker, but this isn't really an option for distribution. If anyone has any ideas on what is slowing down the execution and ways to speed things up I would certainly appreciate it. Thanks.

like image 566
Stephen Avatar asked May 11 '11 21:05

Stephen


People also ask

Why is PyInstaller exe so slow?

PyInstaller's bootloader is usually quite fast in one-dir mode, but it can be much slower in one-file mode, because it depacks everything into a temporary directory. On Windows, I/O is very slow, and then you have antiviruses that will want to double check all those DLL files. PyQt itself is a non-issue.

Which is better py2exe or PyInstaller?

In PyInstaller it is easy to create one exe, By default both create a bunch of exes & dlls. In py2exe its easier to embed manifest file in exe, useful for run as administrator mode in windows vista and beyond. Pyinstaller is modular and has a feature of hooks to include files in the build that you like.

Why is the .exe file created by PyInstaller not working?

The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.


1 Answers

Please look at this info provided with Pyinstaller wiki, http://www.pyinstaller.org/export/latest/tags/1.5/doc/Manual.html?format=raw#how-one-file-mode-works

according to this, When first started, it(one file exe) finds that it needs to extract these files before it can run "for real". . This creation of temporary folder under user's temp directory and extraction of content took initial time.

like image 72
Gagandeep Singh Avatar answered Sep 21 '22 07:09

Gagandeep Singh