title: cx_Freeze - Preventing including unneeded packages
body: <p>I have coded a tiny python program using PyQt4. Now, I want to use cx_Freeze to create a standalone application. Everything works fine - cx_Freeze includes automatically all necessary modules; the resulting exe works.</p>
  
  <p>The only problem is that cx_Freeze packs plenty of unneeded modules into the standalone. Even though I only use QtCore and QtGui, also modules like sqlite3, QtNetwork, or QtScript are included. Surprisingly, I find also PyQt5 dlls in the resulting folder. It seems to me as if cx_Freeze uses all PyQt packages that I have installed. The result is a 200Mb program - albeit I only wrote a tiny script.</p>
  
  <p>How can I prevent this behaviour? </p>
  
  <p>I use the following setup.py:</p>
  
  <pre><code>import sys
  from cx_Freeze import setup, Executable
  
  setup(
      name="MyProgram",
      version="0.1",
      description="MyDescription",
      executables=[Executable("MyProgram.py", base = "Win32GUI")],
  )
  </code></pre>
  
  <p>I tried explicitely excluding some packages (although it is quite messy to exclude all unused Qt modules) adding this code:</p>
  
  <pre><code>build_exe_options = {"excludes": ["tkinter", "PyQt4.sqlite3",
                                "PyQt4.QtOpenGL4", "PyQt4.QtSql"]}
  </code></pre>
  
  <p>but the upper modules were still used. I also tried</p>
  
  <pre><code>build_exe_options = {"excludes": ["tkinter", "PyQt4.sqlite3",
                                "QtOpenGL4", "QtSql"]}
  </code></pre>
  
  <p>with the same result. </p>
  
  <p>In addition to the nedless Qt packages I find also unneded folders with names like "imageformats", "tcl", and "tk". How can I include <strong>only</strong> needed files in order to keep the standalone folder and installer as small as possible?</p>
  
  <p>I googled this problem for hours but only found <a href="https://stackoverflow.com/questions/16769479/how-to-disable-cx-freeze-to-autodetect-all-modules">this thread</a> which did not help me. </p>
  
  <p>I am running python 3.4.2 amd64 on windows 8.</p>
  
  <p>I am happy about every solution that gives me the desired result "standalone" with a reasonable size. I tried also pyqtdeploy but ran into the error: Unknown module(s) in QT (but this is a different question).</p>
  
  <h2>Edit:</h2>
  
  <p>I am using two modules. One is the GUI class created by uic, "MyProgramGUIPreset". In this file there are the following import commands:</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  from matplotlibwidget import MatplotlibWidget
  </code></pre>
  
  <p>In the main module I do the following imports:</p>
  
  <pre><code>import MyProgramGUIPreset
  import numpy as np
  from PyQt4.QtGui import QApplication, QMainWindow, QMessageBox
  import sys
  from math import *
  </code></pre>
  
  <p>Maybe this helps to figuring out where the issue is.</p>