3

I'm trying to use cx_Freeze to generate a .app from a python project. Generally I have it working, but some of my modules which depend on scipy have an import error when executed:

No module named '_csr'

under the build folder I see a file:

scipy.sparse.sparsetools._csr.so

and watching the output of the build command seems to suggest that it's 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 that user seemed to solve it by building again, which hasn't helped here. Any ideas?

UPDATE

I mucked around in the .app package contents and found that renaming scipy.sparse.sparsetools._csr.so to _csr.so solves that error (though generates another similar one for another scipy component). It seems like the cx_Freeze script is not properly naming scipy inputs.

Also, here are the versions I'm using:

  • cx_Freeze: 4.3.2
  • scipy: 0.13.0
  • python: 3.3.2
Community
  • 1
  • 1
Alex Z
  • 1,449
  • 4
  • 20
  • 29
  • Do you have the latest version of cx_Freeze (4.3.2)? Imports changed a bit in Python 3.3, and there might be some fixes in the latest release. – Thomas K Oct 25 '13 at 19:11
  • Oh drat, a bug already... please do report the issue at https://bitbucket.org/anthony_tuininga/cx_freeze/issues so it doesn't get forgotten. – Thomas K Oct 27 '13 at 04:11
  • And provide as much info on the bug report as you're willing to share - your setup.py, the output from freezing, the full traceback of the error you see, even the zipped contents of your build directory, if you don't mind making that public. – Thomas K Oct 27 '13 at 04:27
  • Thanks for the help, I will post an issue. Upon a bit more digging the issue seems to be with importing specific modules: `import scipy` will freeze OK but `import scipy.interpolate` will not. I'll write a quick example. – Alex Z Oct 27 '13 at 13:50

0 Answers0