Using CX_Freeze with Scipy: scipy.special._ufuncs.py

I am having problems freezing a programm of mine. I narrowed it down to the scipy module. The porgramm I am trying to freeze is:

from scipy import signal
signal.hann(1000)

My setup script is:

import sys
from cx_Freeze import setup, Executable

build_exe_options = {}

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

setup(  name = "Some name",
        version = "1.0",
        author="My name",
        description = "My GUI application!",
        options = {"build_exe": build_exe_options},
        executables = [Executable("Script_Name.py", base=base)])
                                    # ^CHANGE THIS NAME!!!

Here is a picture of the error message. I also tried including scipy.signal in the setup file as

build_exe_options = {"includes":"scipy.signal"}

but it didn’t do any good. Please help me.

Best answer

I had a similar problem which could be solved by making sure that:

1 The build directory contains a file named _ufunc.pyd (instead of scipy.special._ufuncs.pyd as mentioned above). You can achieve this by specifying the build_exe_options:

build_exe_options = { 'packages': ['scipy'],
                     "include_files": [('path2python\\Lib\\site-packages\\scipy\\special\\_ufuncs.pyd','_ufuncs.pyd')]}

2 Making sure that all dlls used by ufunc.pyd are also in the build directory. In my case libifcoremd.dll adn libmmd.dll were failing. You can check this with dependencywalker

I hope this helps you out.