10

It's my first post so go easy on me. My problem is similar as in here, but I couldn't make it work, though I really tried: " py2exe with enthought and pandas ".

Having installed separately both versions of python(x84-64, x32) with libraries I proceeded to making an executable of python script using py2exe. I had to download missing dll files: msvcp90.dll, libiomp5md.dll, libifcoremd.dll, libmmd.dll.
Exe files I created return errors and a logfile is generated - different for x32 and x64 python&libraries.

For 32 bit python&libraries I got the following logfiles(different depending on which numpy library I installed from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)

For numpy-1.8.0-win32-superpack-python2.7 I received multipled following information:

File "gui.py", line 7, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "gua.py", line 7, in <module>
File "pyqtgraph\__init__.pyc", line 180, in <module>
File "pyqtgraph\imageview\__init__.pyc", line 6, in <module>
File "pyqtgraph\imageview\ImageView.pyc", line 20, in <module>
File "pyqtgraph\imageview\ImageViewTemplate_pyqt.pyc", line 159, in <module>
File "pyqtgraph\widgets\PlotWidget.pyc", line 10, in <module>
File "pyqtgraph\graphicsItems\PlotItem\__init__.pyc", line 1, in <module>
File "pyqtgraph\graphicsItems\PlotItem\PlotItem.pyc", line 32, in <module>
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 324, in <module>
File "scipy\stats\stats.pyc", line 242, in <module>
File "scipy\special\__init__.pyc", line 531, in <module>
File "scipy\special\_ufuncs.pyc", line 12, in <module>
File "scipy\special\_ufuncs.pyc", line 10, in __load
File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs (scipy\special\_ufuncs.c:19840)
ImportError: No module named _ufuncs_cxx

For numpy-MKL- 1.8.0.win32-py 2.7:

Traceback (most recent call last):
File "gui.py", line 2, in <module>
File "numpy\__init__.pyc", line 154, in <module>
File "numpy\add_newdocs.pyc", line 9, in <module>
File "numpy\lib\__init__.pyc", line 13, in <module>
File "numpy\lib\polynomial.pyc", line 17, in <module>
File "numpy\linalg\__init__.pyc", line 48, in <module>
File "numpy\linalg\linalg.pyc", line 23, in <module>
File "numpy\linalg\lapack_lite.pyc", line 12, in <module>
File "numpy\linalg\lapack_lite.pyc", line 10, in __load
ImportError: DLL load failed: %1 is not a valid Win32 application.

For numpy-MKL-1.7.2rc1.win32-py2.7 I received as above, but multiplied.

For 64 bit python&libraries I got the following, irrelatively of scipy and numpy version:

File "gui.py", line 7, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 4, in <module>
File "scipy\stats\__init__.pyc", line 324, in <module>
File "scipy\stats\stats.pyc", line 242, in <module>
File "scipy\special\__init__.pyc", line 531, in <module>
File "scipy\special\_ufuncs.pyc", line 12, in <module>
File "scipy\special\_ufuncs.pyc", line 10, in __load
File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs (scipy\special\_ufuncs.c:19992)
ImportError: No module named _ufuncs_cxx

I do have some ufuncs files in ..\build\bdist.win-amd64\winexe\collect-2.7\scipy\special , but I'm not sure how it works or should work.

So what do I do to make any of these .exe work? Preferably, the one that goes with 64-bit python, because opening the program by running the code in SciTe with 32-bit python took ages and there was a memory overload.

EDIT:

After removing import numpy, pyqtgraph, scipy from setup.py I get the following logfile with errors:

File "gui.py", line 7, in <module>
File "pyqtgraph\__init__.pyc", line 177, in <module>
File "pyqtgraph\__init__.pyc", line 167, in importAll
File "pyqtgraph\__init__.pyc", line 159, in importModules
Traceback (most recent call last):
File "pyqtgraph\__init__.pyc", line 155, in importModules
File "pyqtgraph\graphicsItems\PlotDataItem.pyc", line 4, in <module>
File "pyqtgraph\graphicsItems\PlotCurveItem.pyc", line 2, in <module>
File "scipy\fftpack\__init__.pyc", line 97, in <module>
File "scipy\fftpack\basic.pyc", line 12, in <module>
File "scipy\fftpack\_fftpack.pyc", line 12, in <module>
File "scipy\fftpack\_fftpack.pyc", line 10, in __load
ImportError: DLL load failed: %1 is not a valid Win32 application.
Elrond_EGLDer
  • 47,430
  • 25
  • 189
  • 180
lottee
  • 113
  • 1
  • 7
  • I'm not sure what it is exactly. All I know it's a part of scipy library. – lottee Dec 03 '13 at 15:13
  • FWIW, I've always had far more luck with [cx_freeze](http://cx-freeze.readthedocs.org/en/latest) than py2exe. – aquavitae Dec 06 '13 at 11:28
  • `_funcs_cxx` is part of the c-extensions that numpy/scipy uses to generalize operation application/broadcasting (stands for universal function I think). The `fftpack` include fortran extensions. – tacaswell Dec 16 '13 at 16:39

3 Answers3

12

I'm having more success with PyInstaller than Py2exe. In PyInstaller, the problem is solved by explicitly adding a reference:

pyinstaller myscript.py --hidden-import=scipy.special._ufuncs_cxx

PyInstaller also takes care of the matplotlib imbroglio, and Visual Studio DLLs.

Pierre
  • 3,470
  • 1
  • 32
  • 33
1

from distutils.core import setup

import py2exe

setup(console=['hello.py'])

edit : do not include any other libraries/modules here

NEXT at the cmd:

python hello.py py2exe

leonneo
  • 888
  • 1
  • 8
  • 14
1

I got the same error message during creating .exe file using py2exe

File "_ufuncs.pyx", line 1, in init scipy.special._ufuncs (scipy\special\_ufuncs.c:22830)

It was resolved by adding scipy.special._ufuncs_cxx to the includes option in setup.py. Here is what I have.

from distutils.core import setup
import py2exe
import numpy

setup(
    console=['hello.py'],
    options={
        'py2exe': {
            r'includes': [r'scipy.sparse.csgraph._validation',
                          r'scipy.special._ufuncs_cxx']
        }
    }
)

Please note that it includes some other settings to prevent numpy/scipy related errors.

  • import numpy
  • includes scipy.sparse.csgraph._validation based on this answer
Community
  • 1
  • 1
fbessho
  • 1,072
  • 1
  • 10
  • 18