2

cx_freeze build includes all modules, that installed on my machine, so freezed build becomes a huge. How to disable autodetection feature? I just want to build small PyQt application:

import sys
from cx_Freeze import setup, Executable

path = sys.path + ["app"]
includes = ["app.core", "app.utils"]
excludes = ["tcl"]
build_exe_options = {
"path": path,
"icon": "resources\icons\clock.ico"}

base = None
if sys.platform == "win32":
    base = "Win32GUI"

setup(  name = "app",
        version = "1.1",
        description = "My Application",
        options = {"build_exe": build_exe_options},
        executables = [Executable("app.py", base=base,
            targetName="app.exe",
            shortcutName="Application",
            shortcutDir="DesktopFolder")])

Also I have the my custom modules, each has a utils submodule, so cx_freeze put wrong module.

How can I set strict list of modules, which i need?

Nikolai Golub
  • 3,327
  • 4
  • 31
  • 61
  • What modules is it including that it shouldn't be? Can you post the log in a pastebin? Don't forget that you'll need several libraries for PyQt and Python itself. – Thomas K May 27 '13 at 18:20
  • It includes all modules, that i have installed on my computer, for example matplotlib, PIL, Tkinter. I have a VM with windows at home, where installed only required minimum(python, and PyQt) and application builds fine. But at work i have a lot of packages + custom packages, so application fails after build. Here is log. http://pastebin.com/G5tp3QkH. I just want to set required minimum of modules and nothing more =) – Nikolai Golub May 28 '13 at 05:06
  • If something in the code loads matplotlib, that could pull in PIL, numpy & tkinter. Try adding matplotlib to 'excludes'. – Thomas K May 29 '13 at 17:11

1 Answers1

1

It was quite simple. This application uses a custom modules, so I've added application folder to the path:

path = sys.path + ["app"]

The trick is that app uses module "utils" and I have other "utils" module in my OS path. Other "utils" module imports a lot of stuff like matplotlib, PIL, etc. So I've solved problem by changing path environment like this:

path = ["app"] + sys.path

So, cx_freeze gets right modules when freeze executable.

Nikolai Golub
  • 3,327
  • 4
  • 31
  • 61