py2exe Problems...

Hello NG,

    this morning I have done the really BIG mistake of uninstalling the
following things:

- Numeric 23.5
- ctypes 0.9.2
- numarray 1.1.1
- Matplotlib 0.72

And I have installed the following:

- Numeric 23.8
- ctypes 0.9.6
- numarray 1.2.3
- Matplotlib 0.74

Using py2exe 0.5.4, now I get some errors on not-found modules, that I put
at the end of the mail. I have never encountered these problems with older
versions of the aforementioned tools. Please note that, a part the VTK things,
almost all the missing modules are from numerix/backends. If I try to start
the application, I get a Visual C++ runtime error (and not the usual MYEXE.exe.log
message from py2exe, so I do not know how to track the error).
I am on a Windows 2000 machine.
Deinstalling the new tools and re-installing the old ones didn't help anymore...

Does anyone have a suggestion?

['backends.draw_if_interactive', 'backends.new_figure_manager', 'backends.show',
'cephes', 'dl', 'libvtkCommonPython', 'libvtkFilteringPython', 'libvtkGraphicsP
ython', 'libvtkHybridPython', 'libvtkIOPython', 'libvtkImagingPython', 'libvtkPa
rallelPython', 'libvtkPatentedPython', 'libvtkRenderingPython', 'numerix.ArrayTy
pe', 'numerix.Complex', 'numerix.Complex32', 'numerix.Complex64', 'numerix.Float
', 'numerix.Float32', 'numerix.Float64', 'numerix.Int', 'numerix.Int16',
'numeri
x.Int32', 'numerix.Int8', 'numerix.Matrix', 'numerix.UInt16', 'numerix.UInt32',
'numerix.UInt8', 'numerix.absolute', 'numerix.add', 'numerix.allclose',
'numerix
.alltrue', 'numerix.arange', 'numerix.arccos', 'numerix.arccosh', 'numerix.arcsi
n', 'numerix.arcsinh', 'numerix.arctan', 'numerix.arctan2', 'numerix.arctanh',
'
numerix.argmax', 'numerix.argmin', 'numerix.argsort', 'numerix.around',
'numerix
.array', 'numerix.arrayrange', 'numerix.asarray', 'numerix.asum', 'numerix.bitwi
se_and', 'numerix.bitwise_or', 'numerix.bitwise_xor', 'numerix.ceil', 'numerix.c
hoose', 'numerix.clip', 'numerix.compress', 'numerix.concatenate', 'numerix.conj
ugate', 'numerix.convolve', 'numerix.cos', 'numerix.cosh', 'numerix.cross_correl
ate', 'numerix.cumproduct', 'numerix.cumsum', 'numerix.diagonal', 'numerix.divid
e', 'numerix.dot', 'numerix.equal', 'numerix.exp', 'numerix.fabs', 'numerix.fft.
fft', 'numerix.floor', 'numerix.fmod', 'numerix.fromfunction', 'numerix.fromstri
ng', 'numerix.greater', 'numerix.greater_equal', 'numerix.hypot', 'numerix.ident
ity', 'numerix.indices', 'numerix.innerproduct', 'numerix.less', 'numerix.less_e
qual', 'numerix.log', 'numerix.log10', 'numerix.logical_and', 'numerix.logical_n
ot', 'numerix.logical_or', 'numerix.logical_xor', 'numerix.matrixmultiply',
'num
erix.maximum', 'numerix.minimum', 'numerix.mlab.amax', 'numerix.mlab.amin',
'num
erix.mlab.cov', 'numerix.mlab.diff', 'numerix.mlab.flipud', 'numerix.mlab.hannin
g', 'numerix.mlab.rand', 'numerix.mlab.std', 'numerix.mlab.svd', 'numerix.multip
ly', 'numerix.negative', 'numerix.nonzero', 'numerix.not_equal', 'numerix.nx',
'
numerix.ones', 'numerix.outerproduct', 'numerix.pi', 'numerix.power', 'numerix.p
roduct', 'numerix.put', 'numerix.putmask', 'numerix.rank', 'numerix.ravel',
'num
erix.repeat', 'numerix.reshape', 'numerix.resize', 'numerix.searchsorted',
'nume
rix.shape', 'numerix.sin', 'numerix.sinh', 'numerix.size', 'numerix.sometrue',
'
numerix.sort', 'numerix.sqrt', 'numerix.subtract', 'numerix.swapaxes', 'numerix.
take', 'numerix.tan', 'numerix.tanh', 'numerix.trace', 'numerix.transpose',
'num
erix.where', 'numerix.which', 'numerix.zeros', 'vtkParallelPython', 'matplotlib.
numerix.absolute', 'matplotlib.numerix.equal', 'numarray.Complex', 'numarray.Com
plex32', 'numarray.Complex64', 'numarray.Float', 'numarray.Float32', 'numarray.F
loat64', 'numarray.Int', 'numarray.Int16', 'numarray.Int32', 'numarray.Int8',
'n
umarray.NumArray', 'numarray.UInt16', 'numarray.UInt32', 'numarray.UInt8',
'numa
rray._dotblas', 'numarray.asarray', 'numarray.dot', 'numarray.fromlist',
'numarr
ay.shape', 'numarray.typecode', 'numarray.zeros', 'wx.BitmapFromImage',
'wx.Empt
yIcon']

Hello NG,

    I found where the incompatibilities between Matplotlib and py2exe reside,
at least on my configuration (Windows XP or 2000, Matplotlib 0.74 or 0.72pre,
wxPython 2.5.5.1 or previous). The following line in dates.py:

UTC = timezone('UTC') (line 94)

Breaks the executable with the error "Unknown timezone" or something similar.

Next, the way the Matplotlib developers are handling docstrings in pylab.py
(and others), like:

figimage.__doc__ = Figure.figimage.__doc__ + """
Addition kwargs: hold = [True|False] overrides default hold state"""

Breaks py2exe with an error like:

"Can not concatenate NoneType with str"

I just commented out these lines because I don't need docstrings in my executable,
but if someone has a better idea, I welcome all suggestions.

Thank you a lot.

Andrea.

Hi,

I've had some fun building py2exe stuff with matplotlib too, see below
for some comments and help.

Hello NG,

    I found where the incompatibilities between Matplotlib and py2exe reside,
at least on my configuration (Windows XP or 2000, Matplotlib 0.74 or 0.72pre,
wxPython 2.5.5.1 or previous). The following line in dates.py:

UTC = timezone('UTC') (line 94)

Breaks the executable with the error "Unknown timezone" or something similar.

I've encountered this one before, it's to do with the pytz module and
py2exe's modulefinder. Basically pytz dynamically imports modules, so
py2exe has some difficulty with it. For my pyexe I added the following
to the includes list:

"pytz",
"pytz.zoneinfo",
"pytz.zoneinfo.UTC",
"pytz.zoneinfo.US",
"pytz.zoneinfo.US.Eastern",
"pytz.zoneinfo.US.Central",
"pytz.zoneinfo.US.Mountain",
"pytz.zoneinfo.US.Pacific",
"pytz.zoneinfo.Europe.London",
"pytz.zoneinfo.Europe.Paris",
"pytz.zoneinfo.Europe.Berlin",
"pytz.zoneinfo.Europe.Moscow",

For me this seemed to cover all the timezones I encountered.

Next, the way the Matplotlib developers are handling docstrings in pylab.py
(and others), like:

figimage.__doc__ = Figure.figimage.__doc__ + """
Addition kwargs: hold = [True|False] overrides default hold state"""

Breaks py2exe with an error like:

"Can not concatenate NoneType with str"

I just commented out these lines because I don't need docstrings in my executable,
but if someone has a better idea, I welcome all suggestions.

I've never seen this one before, it might be because I'm building with
an older copy of matplotlib.

For reference here is my complete set of matplotlib includes:

"encodings",
"encodings.ascii",
"encodings.idna",
"encodings.iso8859_1",
"encodings.utf_8",
"encodings.string_escape",
"matplotlib",
"matplotlib._na_image",
"matplotlib._na_transforms",
"matplotlib._nc_image",
"matplotlib._nc_transforms",
"matplotlib.ft2font",
"matplotlib.backends",
"matplotlib.backends._backend_agg",
"matplotlib.backends._tkagg",
"matplotlib.backends._gtkagg",
"matplotlib.backends.backend_agg",
"matplotlib.backends.backend_tkagg",
"matplotlib.backends.backend_gtkagg",
"matplotlib.numerix",
"matplotlib.numerix.fft",
"matplotlib.numerix.linear_algebra",
"matplotlib.numerix.mlab",
"matplotlib.numerix.random_array",
"pytz",
"pytz.zoneinfo",
"pytz.zoneinfo.UTC",
"pytz.zoneinfo.US",
"pytz.zoneinfo.US.Eastern",
"pytz.zoneinfo.US.Central",
"pytz.zoneinfo.US.Mountain",
"pytz.zoneinfo.US.Pacific",
"pytz.zoneinfo.Europe.London",
"pytz.zoneinfo.Europe.Paris",
"pytz.zoneinfo.Europe.Berlin",
"pytz.zoneinfo.Europe.Moscow",
"numarray",
"numarray.convolve._correlate",
"numarray.convolve._lineshape",
"numarray.fft.fftpack",
"numarray.image._combine",
"numarray.linear_algebra.lapack_lite2",
"numarray.nd_image._nd_image",
"numarray.random_array.ranlib2",
"numarray._bytes",
"numarray._chararray",
"numarray._conv",
"numarray._converter",
"numarray._ndarray",
"numarray._numarray",
"numarray._objectarray",
"numarray._operator",
"numarray._sort",
"numarray._ufunc",
"numarray._ufuncBool",
"numarray._ufuncComplex32",
"numarray._ufuncComplex64",
"numarray._ufuncFloat32",
"numarray._ufuncFloat64",
"numarray._ufuncInt16",
"numarray._ufuncInt32",
"numarray._ufuncInt64",
"numarray._ufuncInt8",
"numarray._ufuncUInt16",
"numarray._ufuncUInt32",
"numarray._ufuncUInt8",
"numarray.libnumarray",
"numarray.libnumeric",
"numarray.memory",

I don't use numeric so I can't comment on the includes there (I have a
half hearted attempt, but I don't think it's complete).

regards,
  Michael

···

On Apr 10, 2005 10:31 PM, andrea_gavana@...517... <andrea_gavana@...517...> wrote:

Hi Andrea and others,

I think the timezone stuff you can solve by putting "pytz" into the packages to include.

Isn't the optimize : 2 getting rid of the doc stuff?

# options for py2exe
options = {"py2exe": {"compressed": 1,
                       "optimize": 2,
                       "packages": ["encodings", "kinterbasdb", "pytz"],
                       "includes": ["ntpath"]}
           }

I get an error about ntpath, that is why I put it to includes, but it doesn't solve the problem - posted it on the py2exe newsgroup.

See you
Werner

andrea_gavana@...517... wrote:

···

Hello NG,

    I found where the incompatibilities between Matplotlib and py2exe reside,
at least on my configuration (Windows XP or 2000, Matplotlib 0.74 or 0.72pre,
wxPython 2.5.5.1 or previous). The following line in dates.py:

UTC = timezone('UTC') (line 94)

Breaks the executable with the error "Unknown timezone" or something similar.

Next, the way the Matplotlib developers are handling docstrings in pylab.py
(and others), like:

figimage.__doc__ = Figure.figimage.__doc__ + """
Addition kwargs: hold = [True|False] overrides default hold state"""

Breaks py2exe with an error like:

"Can not concatenate NoneType with str"

I just commented out these lines because I don't need docstrings in my executable,
but if someone has a better idea, I welcome all suggestions.

Thank you a lot.

Andrea.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click

Hello Werner & NG,

I think the timezone stuff you can solve by putting "pytz" into the
packages to include.

This is how my setup.py looks like:

# incl are other includes
includes = incl + ["pytz","pytz.zoneinfo"]

excludes = ["Tkconstants", "Tkinter", "tcl", '_gtkagg', '_tkagg']
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll']

setup(

    version = "1.0.0",
    description = "MyApp",
    name = "MyApp",

    data_files = [('matplotlibdata', glob.glob(r'c:\python23\share\matplotlib\*')),
                  ('matplotlibdata', [r'c:\python23\share\matplotlib\.matplotlibrc'])],

    options = {"py2exe": {"compressed": 1,
                          "optimize": 2,
                          "includes": includes,
                          "excludes": excludes,
                          "dll_excludes": dll_excludes}},

    windows = ["MyApp.py"]

    )

I still get the TimeZone error...

Isn't the optimize : 2 getting rid of the doc stuff?

I didn't even imagine that the optimize option would interfere with the
doc strings... is it a normal thing?!?

Thanks to you all.

Andrea.