When I try to “freeze” a Python application (v2.78) that uses PyQt4 (v4.10.4) and Matplotlib (v1.4.2) under Windows XP SP3 using PyInstaller (v2.1), I launch an annoying problem.
At the very beginning of my program, I have the following lines:
import matplotlib matplotlib.use("Qt4Agg") matplotlib.rcParams["backend.qt4"] = "PyQt4" from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure
When I launch PyInstaller using the line:
pyinstaller --noconsole --icon=app.ico App.py
the application is correctly frozen in the "dist" folder and it works without any problems. The problem is that a lot of junk files are included in the distribution folder! These “junk” files belong to several “wx” modules, which are obviously useless for my application (since it uses Qt, not Wx for the user interface). If I manually delete these files from the dist folder, the application still works very well.
So my big question is: how do I get rid of these unwanted files when freezing an application using PyInstaller?
I could find several possible solutions to similar problems with py2exe and cx_Freeze, but nothing related to PyInstaller (and this is my preferred “compiler” because it was the only cross-platform one that seems to work very well under Windows and Linux).
Thanks in advance for any help you can provide!
EDIT: Also, when starting PyInstaller, I received an ugly error message:
43592 INFO: Processing hook hook-matplotlib Traceback (most recent call last): File "<string>", line 3, in <module> File "C:\Python27\lib\site-packages\matplotlib\backends\backend_webagg.py", li ne 30, in <module> raise RuntimeError("The WebAgg backend requires Tornado.") RuntimeError: The WebAgg backend requires Tornado.
But, of course, I don’t use the WebAgg backend (and I don’t know what the Tornado is!).
Towards the end of the freezing process, I received a warning:
265046 WARNING: lib not found: gdiplus.dll dependency of C:\Python27\lib\site-pa ckages\wx-2.8-msw-unicode\wx\wxmsw28u_core_vc.dll
I would also like to get rid of both messages during the freeze process (which, I believe, will be when the problem of getting rid of unwanted backends is solved)!
"