I am trying to use cx_Freeze to create .app from a python project. I usually work, but some of my modules, which depend on scipy, have an import error on execution:
No module named '_csr'
in the build folder, I see the file:
scipy.sparse.sparsetools._csr.so
and looking at the output of the build command seems to suggest that it is copying csr:
$ python3 setup.py bdist_mac | grep csr m scipy.sparse.csr /usr/local/lib/python3.3/site-packages/scipy/sparse/csr.py m scipy.sparse.sparsetools._csr /usr/local/lib/python3.3/site-packages/scipy/sparse/sparsetools/_csr.so m scipy.sparse.sparsetools.csr /usr/local/lib/python3.3/site-packages/scipy/sparse/sparsetools/csr.py ? _csr imported from scipy.sparse.sparsetools.csr ? os.path imported from NIF_WRF.util.StopPow, distutils.file_util, matplotlib.backends.backend_tkagg, matplotlib.cbook, numpy.core.memmap, numpy.distutils.command.scons, os, pkg_resources, pkgutil, scipy.lib.blas.scons_support, scipy.lib.blas.setup, scipy.lib.lapack.scons_support, scipy.linalg.setup, scipy.sparse.csgraph.setup, scipy.sparse.linalg.dsolve.setup, scipy.sparse.linalg.eigen.arpack.setup, scipy.sparse.linalg.isolve.setup, scipy.sparse.sparsetools.bsr, scipy.sparse.sparsetools.coo, scipy.sparse.sparsetools.csc, scipy.sparse.sparsetools.csgraph, scipy.sparse.sparsetools.csr, scipy.sparse.sparsetools.dia, scipy.special.setup, shutil, sysconfig ? scipy.lib.six.moves imported from scipy.integrate.quadrature, scipy.interpolate.interpolate, scipy.interpolate.polyint, scipy.linalg.special_matrices, scipy.misc.common, scipy.optimize.anneal, scipy.optimize.linesearch, scipy.optimize.nonlin, scipy.sparse.base, scipy.sparse.compressed, scipy.sparse.coo, scipy.sparse.csc, scipy.sparse.csr, scipy.sparse.dok, scipy.sparse.lil, scipy.sparse.linalg.eigen.lobpcg.lobpcg, scipy.sparse.linalg.isolve.lgmres, scipy.spatial.distance, scipy.special.basic, scipy.stats.stats copying /usr/local/lib/python3.3/site-packages/scipy/sparse/sparsetools/_csr.so -> build/exe.macosx-10.8-x86_64-3.3/scipy.sparse.sparsetools._csr.so
The problem seems to be related to this other question , but this user seems to have decided to create it again, which did not help here. Any ideas?
UPDATE
I retired to the contents of the .app package and found that renaming scipy.sparse.sparsetools._csr.so to _csr.so solves this error (although it generates another similar for another scipy component). It seems that the cx_Freeze script incorrectly names scipy inputs.
In addition, here are the versions I use:
- cx_Freeze: 4.3.2
- scipy: 0.13.0
- python: 3.3.2