Search code examples
pythonwindowscx-freezepyzmq

How do I make pyzmq (14.3.1) and cx_Freeze (4.3.3) work together


How do I make pyzmq (as of 14.3.1) and cx_Freeze (as of 4.3.3) work together? By default, cz_Freeze doesn't include all required pyzmq components, at least on Windows.


Solution

  • The following tweaks to setup.py do the trick for me, at least on Windows (see comments):

    from cx_Freeze import setup, Executable
    import zmq.libzmq
    
    build_exe_options = {
        # zmq.backend.cython seems to be left out by default
        'packages': ['zmq.backend.cython', ],
        # libzmq.pyd is a vital dependency
        'include_files': [zmq.libzmq.__file__, ],
    }
    
    setup(
        name='myapp',
        version='0.0.1',
        description='My App',
        options={'build_exe': build_exe_options},
        executables=[Executable('bin/myapp.py')],
    )