Exe created with py2exe doesn't work and returns logfile with errors Exe created with py2exe doesn't work and returns logfile with errors numpy numpy

Exe created with py2exe doesn't work and returns logfile with errors


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.


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


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 setupimport py2exeimport numpysetup(    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