I am trying to export my Python script to a high performance cluster (running CentOS 6), while circumventing the need to install additional Python packages. I use a virtual CentOS 6 environment onto which I installed all the required packages to create an executable using cx_freeze
, which I can then transfer to the cluster for execution.
I ran into some errors with scipy
and cx_freeze
that I now believe to be resolved (thanks to extensive documentation on this subject on StackOverflow).
However, I immediately got another error that I don't understand. I can not find any information on the supposed module that is missing, nor on the error itself, let alone in combination with cx_freeze
.
The following error is generated when I try to run the executable:
ImportError: No module named core_cy
I use the following setup.py
from the file to build the executable using cx_freeze:
import sys
import scipy
from os import path
from cx_Freeze import setup, Executable
includefiles_list=[]
scipy_path = path.dirname(scipy.__file__)
includefiles_list.append(scipy_path)
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "include_files": includefiles_list}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
setup( name = "CD34Filter",
version = "0.1",
description = "CD34Filter Script",
options = {"build_exe": build_exe_options},
executables = [Executable("cd34_filter.py", base=base)])
I already tried adding the "excludes": ["core_cy"]
option to build_exe_options
. But that didn't do anything.
Thank you in advance!
After some additional research, I found out that core_cy
is a module of the skimage
module. I proceeded by including scikit-image into the package in the same manner I used to include the scipy
. This resolved the error and now my executable runs great! Hope this will be of use to anyone else.
import sys
import scipy
import skimage
from os import path
from cx_Freeze import setup, Executable
includefiles_list=[]
scipy_path = path.dirname(scipy.__file__)
skimage_path = path.dirname(skimage.__file__)
includefiles_list.append(scipy_path)
includefiles_list.append(skimage_path)
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"], "include_files": includefiles_list}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
setup( name = "CD34Filter",
version = "0.1",
description = "CD34Filter Script",
options = {"build_exe": build_exe_options},
executables = [Executable("cd34_filter.py", base=base)])