1

at the moment I am facing a problem regarding scipy and cx-Freeze.

Windows 7 Enterprise (64-Bit);
Python 3.5.2|Anaconda 4.2.0 (64-bit);
scipy 0.18.1;
cx-Freeze 5.0.1;

I want to freeze a python script into an executable. Below you find the source code and the freeze script.

main.py

import scipy

if __name__ == '__main__':
    print('Test dirstribution methods!')

That's the main.py file.

setup.py

import sys
from cx_Freeze import *

packages = ['numpy']
excludes = ['tkinter']

distTest_Target = Executable(
    script = "main.py",
    base = "Console",
    shortcutName="distTest",
    targetName = "distTest.exe"
)

build_exe_options  = {
    "packages": packages,
    "excludes":excludes
}

setup(name='distTest',
    version='1.0.0',
    description='distTest (64-bit)',
    options = {"build_exe": build_exe_options},
    executables=[distTest_Target]
)

The build process executes without errors, but if I try to start the exe I get the following Error: Figure: Error during execution of exe

If I try to add 'scipy' to the package list like packages = ['numpy','scipy'] I get another error during the build process: Figure: scipy ImportError.

Has anybody an idea what is wrong there? Thank you in advance for your help!

M. Do.
  • 11
  • 4
  • Possible duplicate of [Scipy and CX\_freeze - Error importing scipy: you cannot import scipy while being in scipy source directory](http://stackoverflow.com/questions/32694052/scipy-and-cx-freeze-error-importing-scipy-you-cannot-import-scipy-while-being) – MrLeeh Mar 14 '17 at 07:42
  • Unfortunately not. I already tried the suggested solution in your link. Yesterday I installed the latest version of Anaconda (4.3.1). There an other error occured and finnaly this made it work: [Bitbucket](https://bitbucket.org/anthony_tuininga/cx_freeze/issues/43/import-errors-when-using-cx_freeze-with) (Post by Keegan Owsley). After some other minor problems it almost works now ;) – M. Do. Mar 15 '17 at 07:34

1 Answers1

0

Installing the latest version of Anaconda (4.3.1) and editing hooks.py in the cx_freeze package:

finder.IncludePackage("scipy.lib")

replaced by:

finder.IncludePackage("scipy._lib")

solved the problem.

M. Do.
  • 11
  • 4