title: Using PyInstaller to freeze a Python application with PyQt4 + Matplotlib
body: <p>While attempting to "freeze" a Python (v2.78) app which uses PyQt4 (v4.10.4) and Matplotlib (v1.4.2) under Windows XP SP3, using PyInstaller (v2.1), I am running into an annoying problem.</p>
  
  <p>At the very beginning of my program, I have the following lines:</p>
  
  <pre><code>import matplotlib
  matplotlib.use("Qt4Agg")
  matplotlib.rcParams["backend.qt4"] = "PyQt4"
  from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
  from matplotlib.figure import Figure
  </code></pre>
  
  <p>When I run PyInstaller using the line:</p>
  
  <pre><code>pyinstaller --noconsole --icon=app.ico App.py
  </code></pre>
  
  <p>the application is correctly frozen into the "dist" folder and it runs without any hassles. The problem is, a lot of unwanted files are included into the distribution folder! By these "unwanted" files, I refer to the several "wx" modules which are obviously useless to my application (since it uses Qt and not Wx for the UI). If I manually delete these files from the dist folder, the app still runs very well. </p>
  
  <p>So, my big question is: how do I get rid of these unwanted files when freezing the app with PyInstaller?</p>
  
  <p>I could find several possible solutions for similar problems with py2exe and cx_Freeze, but nothing that refers to PyInstaller (and these is my preferred "compiler" because it has been the only cross-platform one that seems to work very well under Windows and  Linux).</p>
  
  <p>Thanks in advance for any assistance you can provide!</p>
  
  <p>EDIT: Also, when running PyInstaller, I got an ugly error message:</p>
  
  <pre><code>43592 INFO: Processing hook hook-matplotlib
  Traceback (most recent call last):
    File "&lt;string&gt;", line 3, in &lt;module&gt;
    File "C:\Python27\lib\site-packages\matplotlib\backends\backend_webagg.py", li
  ne 30, in &lt;module&gt;
      raise RuntimeError("The WebAgg backend requires Tornado.")
  RuntimeError: The WebAgg backend requires Tornado.
  </code></pre>
  
  <p>But of course I am not using any WebAgg backend (and have no idea what the heck is "Tornado"!).</p>
  
  <p>By the end of the freezing process, I got a warning:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I also would like to get rid of both messages, during the freezing process (which I presume I will be, when the problem of getting rid of unwanted backends is solved)!</p>
  
  <p>"</p>