problem compiling matplotlib latex (mathtext) using py2exe

Hi all,

I have a application using a wxPython gui which has matplotlib figure, axes etc… The code works fine and the display of mathtext works fine when run in python.

When I compile it and try to display any text it doesn’t render the text at all (this can be anything from a simple letter to a more complex equation).

I get an output error:

myDir\dist\\matplotlib\ MathTextWarning: Unrecognized symbol ‘y’. Substituting with a dummy symbol.

I added the the include “matplotlib.mathtext” as before I got an error that it didn’t know what mathtext was.

Any ideas? I’ve looked on line at, and tried all they suggest but no luck so far.

Thanks for any ideas.


my py2exe file is:

from distutils.core import setup
import py2exe
from distutils.core import setup

We need to import the glob module to search for all files.

import glob
import matplotlib

opts = {
‘py2exe’: { “includes” : [“matplotlib.backends.backend_wxagg”,
“matplotlib.figure”,“pylab”, “numpy”, “matplotlib.numerix.fft”,
“matplotlib.numerix.linear_algebra”, “matplotlib.numerix.random_array”,
“matplotlib.mathtext” ],
‘dll_excludes’: [‘libgdk-win32-2.0-0.dll’,

Looked online and tried this next line - but it doesn’t compile.


Save matplotlib-data to mpl-data ( It is located in the matplotlib\mpl-data

folder and the compiled programs will look for it in \mpl-data

note: using matplotlib.get_mpldata_info

data_files = [(r’mpl-data’, glob.glob(r’C:\Python25\Lib\site-packages\matplotlib\mpl-data*.’)),
# Because matplotlibrc does not have an extension, glob does not find it (at least I think that’s why)
# So add it manually here:
(r’mpl-data’, [r’C:\Python25\Lib\site-packages\matplotlib\mpl-data\matplotlibrc’]),

setup(windows=[{“script” : “”}], options=opts, data_files=data_files)


News, Sports, Entertainment and Weather on your mobile. Text MSN to 63463 Now.