[PyQt] PyQt4 - Py2exe - Missing DLLs problem

Giovanni Bajo rasky at develer.com
Fri Feb 1 12:06:09 GMT 2008


On 1/31/2008 4:53 PM, Angel Leon wrote:

>   In the past I'd build a py2exe distributable of my app, and the py2exe
> would be missing for some reason Qt4svg.dll, I'd then manually copy the dll,
> and my app would launch.
> 
>   does anyone have a similar problem? do you solve it by adding file copy
> commands to your build script, or is there something you can do to your
> py2exe script?

As others said, this works with PyInstaller without manual intervention.

>  also, I'm very concerned about the size of my application installer, I
> think my app shouldn't be needing qt4svg.dll since I'm not doing any vector
> graphics, just basic Qt4 widgets, is there any way to break this
> dependencies and only distribute my app with a minimum number of qt4 dlls?

This requires manual intervention :)

PyInstaller always errs on the safe side, so that in many cases it 
"just" works (that I found out being the more important property for 
such packages).

If you want to finetune the size of a PyQt application, the best way is 
to recompile Qt/PyQt use a consolidated module. Basically:

- Compile Qt statically (configure -static). It will build static 
libraries (.lib) instead of dlls.
- Compile PyQt with "--consolidate" (but *without* --static, since you 
still want a dynamic .pyd module). Add --enable for the modules you need 
and --plugin for the plugins you need.

This will give you a big _qt.pyd with everything inside (no external 
dependencies), plus small Qt*.pyd wrappers to make your existing code 
work. You will save space twice because:

1) it will just include the parts you need
2) it will compress *tons* better (because there are no relocations 
symbols, more stuff is inlined, etc.).

Give that to PyInstaller trunk with latest UPX (with LZMA support) and 
rejoyce :)

Then, you might want to see the output of ArchiveViewer.py run over the 
final executable, so that you will see the list of all modules that have 
been brought in. If there's something that PyInstaller thought you might 
need but you actually don't use, you can handedit the excludes=[] list 
in the .spec file to avoid bringing them in.
-- 
Giovanni Bajo



More information about the PyQt mailing list