python - Tkinter, Matplotlib, py2exe: Import Error: DLL load failed when running .exe -


i have python program called uimaster.py turning executable using py2exe. when run setup.py file in terminal, creating build , dist folders , including uimaster.exe file in dist folder, however; when double click terminal window pops waits second , writes text (closes read) closes. however, when run python program python, works. not 100% sure why happening. using matplotlib , think may causing problem. sure need exclude things options , possibly add somethign data files, not sure if right. when go terminal , cd dist , run uimaster.exe, following message:

traceback (most recent call last):     file "uimaster.py", line 7, in <module>     file "matplotlib\__init__.pyc", line 1100, in <module>     file "matplotlib\__init__.pyc", line 947, in rc_params     file "matplotlib\__init__.pyc", line 789, in matplotlib_fname     file "matplotlib\__init__.pyc", line 325, in wrapper     file "matplotlib\__init__.pyc", line 693, in _get_data_path_cached     file "matplotlib\__init__.pyc", line 689, in _get_data_path runtimeerror: not find matplotlib data files 

the following code in setup.py:

    distutils.core import setup     import zmq.libzmq     import py2exe     import numpy     setup(         console = ['uimaster.py'],         zipfile='lib/library.zip',         options={             'py2exe': {                 'includes': ['zmq.backend.cython'],                 'excludes': ['zmq.libzmq'],                 'dll_excludes': ['libzmq.pyd'],             }         },         data_files=[             ('lib', (zmq.libzmq.__file__,))         ]     ) 

i have tried following , still same error message:

from distutils.core import setup import zmq.libzmq import py2exe import numpy import matplotlib import pylab setup(     console = ['uimaster.py'],     zipfile='lib/library.zip',     options={         'py2exe': {             'includes': ['zmq.backend.cython'],             'excludes': ['zmq.libzmq','_gtkagg', '_tkagg'],             'dll_excludes': ['libzmq.pyd'],         }     },     data_files=[         ('lib', (zmq.libzmq.__file__,),matplotlib.get_py2exe_datafiles() )     ] ) 

at last, tried following , got same error message:

from distutils.core import setup import zmq.libzmq import py2exe import matplotlib setup(     console = ['uimaster.py'],     zipfile='lib/library.zip',     options={         'py2exe': {             'packages': ['matplotlib', 'pytz'],             'includes': ['zmq.backend.cython'],             'excludes': ['zmq.libzmq','_gtkagg', '_tkagg'],             'dll_excludes': ['libzmq.pyd','libgdk-win32-2.0-0.dll',                                      'libgobject-2.0-0.dll',                                      'libgdk_pixbuf-2.0-0.dll',                                      'libgtk-win32-2.0-0.dll',                                      'libglib-2.0-0.dll',                                      'libcairo-2.dll',                                      'libpango-1.0-0.dll',                                      'libpangowin32-1.0-0.dll',                                      'libpangocairo-1.0-0.dll',                                      'libglade-2.0-0.dll',                                      'libgmodule-2.0-0.dll',                                      'libgthread-2.0-0.dll',                                      'qtgui4.dll', 'qtcore.dll',                                      'qtcore4.dll'],         }     },     data_files=[         ('lib', (zmq.libzmq.__file__,),matplotlib.get_py2exe_datafiles(),)     ] ) 

note: having adjust zmq module

i use py2exe on pyinstaller because not familiar pyinstaller if can give me pointers on pyinstaller down use executable conversion.

edit: attempted use pyinstaller , keep getting

ioerror errno[22] invalid mode <'rb'> or filename: " 

is there else need executable , running? generating build , dist folders, have no clue why program isin't popping executable. guys!

edit: when using matplotlib.get_py2exe_datafiles()

the following error produced when go dist folder , run .exe:

  file "uimaster.py", line 7, in <module>   file "matplotlib\pyplot.pyc", line 109, in <module>   file "matplotlib\backends\__init__.pyc", line 32, in pylab_setup   file "matplotlib\backends\backend_qt4agg.pyc", line 17, in <module>   file "matplotlib\backends\backend_qt5agg.pyc", line 18, in <module>   file "matplotlib\backends\backend_qt5.pyc", line 31, in <module>   file "matplotlib\backends\qt_compat.pyc", line 91, in <module>   file "pyqt4\qtcore.pyc", line 12, in <module>   file "pyqt4\qtcore.pyc", line 10, in __load   importerror: dll load failed: specified module not found. 


Comments