1. Anthony Tuininga
  2. cx_Freeze
  3. Issues
Issue #38 new

Missing internal modules and packages for python 3

Anonymous created an issue

I use python 3.3 and when I run cx_Freeze I find that all internal packages and modules are missing with the exception of main and modules within the main scripts directory.

import TestModule
MyClass = Statement.MyClass

#Results in "Missing modules: ? Test.MyClass imported from main__main__ "
from TestModule import MyClass

#Results in "Missing modules: ? TestPackage imported from main__main__ "
import TestPackage

Comments (8)

  1. Rogier Sluimers

    Me again, I just want to ask that if this takes an hour or so to fix, but the coder has no time to, then can the coder tell me which files should be looked at if someone else would like to?

  2. Thomas Kluyver

    I've used it with Python 3.3 before without seeing this problem, so the first thing is to work out what's causing the problem. What operating system do you see this on? Are you running the latest released version of cx_Freeze? Have you tried with the development version? Can you provide the output from freezing your script?

  3. Thomas Kluyver

    I've not tried with MingW - possibly you need to use the free version of Visual Studio, which is what Python is compiled with. It's the 2010 version for Python 3.3.

    Where are the modules that you are trying to import?

  4. Rogier Sluimers

    I installed cxFreeze from source code now. It still won't find internal modules. My current setup looks like this:


    from Utils import Color
    if __name__ == "__main__":


    WhitePinky = "#FFEEEE"


    import sys
    from cx_Freeze import setup, Executable
    path_platforms = ()
    includes = []
    includefiles = []
    excludes = [
        '_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
        'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
        'Tkconstants', 'Tkinter'
    packages = ["os"]
    path = []
    # Dependencies are automatically detected, but it might need fine tuning.
    build_exe_options = {
                         "includes":      includes, 
                         "include_files": includefiles,
                         "excludes":      excludes, 
                         "packages":      packages, 
                         "path":          path
    # GUI applications require a different base on Windows (the default is for a
    # console application).
    base = None
    exe = None
    if sys.platform == "win32":
        exe = Executable(
            initScript = None,
            targetDir = r"dist",
            compress = True,
            copyDependentFiles = True,
            appendScriptToExe = False,
            appendScriptToLibrary = False,
            icon = None
          name = "Balie",
          version = "0.1",
          author = 'Rogier Sluimers',
          description = "My GUI application!",
          options = {"build_exe": build_exe_options},
          executables = [exe]

    This is my output:


  5. Rogier Sluimers

    I think I found the problem. My setup.py file is in a subfolder and my guess is that cxFreeze searches for internal modules from setup.py's folder and not Main's. It works when I put setup.py in the same folder as Main's.

    I put setup.py there so I could seperate cxFreeze's files from the rest of my project.

    I moved setup.py to the Main's folder and it seems to be worknig in order now. The only thing bothering me now is that when I choose the generated files to go to target directory dist, all library files (pyd's, dll's and library.zip), with the exception of python33.dll, are build in the exe.win-amd64-3.3 folder.

    Another thing, if I do a:

    python ../setup.py bdist_msi

    Not all files end up inside the msi file. Notably the executable and the zip file containing the project's compiled files are missing.

    Also, my project files end up in the library zip and not the project zip. I think it's due to my batch file not being in the same directory as my Main.py file.

  6. Thomas Kluyver

    Yes, you're probably right about it looking from the location of setup.py. I wonder how easy that would be to fix.

    The options when you create Executable() are a bit misleading - if you set targetDir there, it will only affect the files specific to that executable, rather than all the files it needs (because you can build more than one executable in the same setup.py). Try setting an option like build_exe:build_exe instead (docs). I think that will solve your bdist_msi issue as well.

  7. Log in to comment