views:

201

answers:

2

Are there major/common/important packages that py2exe cannot handle?

I am currently studying the possibility of creating a .exe from a Python program that will use Tkinter, some Excel file reading module, NumPy, SciPy and matplotlib: is it realistic to try to achieve this with py2exe?

+1  A: 

It's realistic to try, sure. You'll probably hit a few issues but I doubt you'll reach a blocker, especially with very common packages.

You can get a quick look at how well py2exe works with various libraries here:

http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules

For anything not listed there, fire off a quick google for py2exe <package-name>

Oli
+1: Thank you, Oli! I selected the most detailed answer, but yours is certainly useful!
EOL
+2  A: 

I routinely build py2exe single file executables using Scipy, matplotlib, wxpython and win32com or the Machin's xlrd/xlwt modules. Never used Tkinter but should not be a problem, probably wxpython is more picky.

I have found some problems with numpy/scipy, matplotlib and wxpython before and after building the executable but after you know what to do it works smoothy.

Some problems:

matplotlib requires to indicate where some auxiliary archives are. You need to add to your setup.py

datafiles = matplotlib.get_py2exe_datafiles()

numpy/scipy have given me some problems, due to some expresions in the modules, when executing the py2exe executable. Numpy has some lines suchs as:

__doc__ += "something more"

that fail when __doc__ is None.
For this I had to modify manually the numpy scripts (including if's). I do not know if this has been solved in the new versions.

wxpython is generally a source of problems due to some required microsoft dlls that have to be present in the computer to work. Just you have to be carefull assuring you provide them in your package or at least preventing your users about the issue.

Some useful hints can also be found in the py2exe and wxpython wikis

joaquin
You say "I routinely build py2exe single file executables using Scipy, matplotlib, wxpython and win32com or the Machin's xlrd/xlwt modules. [snip] I have found some problems with all of these modules" ... but didn't say what problems that you had with "the Machin's xlrd/xlwt modules". Please elaborate. I've packaged executables using both modules myself with no problems. The only problems that have been raised in the python-excel google-group have been self-inflicted IIRC.
John Machin
@John, I should said except with xlrd/xlwt and in fact either do not remember now a specific one with win32com. I corrected the text accordingly.
joaquin