Matplotlib 1.0 upgrade breaks latex functionality?

Hello,

I recently upgraded matplotlib v0.98.5 to 1.0. Now when I try to plot data using latex for the figure labels my scripts fail. I have not changed my code so I'm not sure where the error is coming from. I have tried reinstalling and updating MikTex and Ghostscript but that has not helped (I'm running Windows 7 and Python 2.6). The actual error I get is below. Any thoughts?

Thanks,

Steve

Traceback (most recent call last):
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4.py", line 215, in resizeEvent
self.draw()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 130, in draw
FigureCanvasAgg.draw(self)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 394, in draw
self.figure.draw(self.renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 798, in draw
func(*args)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1934, in draw
a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 1017, in draw
tick.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 236, in draw
self.label2.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 524, in draw
bbox, info = self._get_layout(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 307, in _get_layout
ismath=ismath)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 171, in get_text_width_height_descent
renderer=self)
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 608, in get_text_width_height_descent
page = iter(dvi).next()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 65, in __iter__
have_page = self._read()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
self._dispatch(byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 370, in _fnt_def
vf = _vffile(n[-l:])
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 871, in _vffile
return _fontfile(texname, Vf, '.vf', _vfcache)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 860, in _fontfile
result = class_(filename)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 479, in __init__
self._read()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
self._dispatch(byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 508, in _dispatch
Dvi._dispatch(self, byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 546, in _fnt_def
Dvi._fnt_def(self, k, *args)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 372, in _fnt_def
self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 418, in __init__
nchars = max(tfm.width.iterkeys()) + 1
AttributeError: 'NoneType' object has no attribute 'width'
Traceback (most recent call last):
File "C:\Users\steve.nicholes\Documents\Beamformer\Design\SOA\SOA Design.py", line 333, in <module>
show()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4.py", line 71, in show
figManager.canvas.draw()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 130, in draw
FigureCanvasAgg.draw(self)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 394, in draw
self.figure.draw(self.renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 798, in draw
func(*args)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1934, in draw
a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 1017, in draw
tick.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 236, in draw
self.label2.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 524, in draw
bbox, info = self._get_layout(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 307, in _get_layout
ismath=ismath)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 171, in get_text_width_height_descent
renderer=self)
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 608, in get_text_width_height_descent
page = iter(dvi).next()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 65, in __iter__
have_page = self._read()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
self._dispatch(byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 370, in _fnt_def
vf = _vffile(n[-l:])
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 871, in _vffile
return _fontfile(texname, Vf, '.vf', _vfcache)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 860, in _fontfile
result = class_(filename)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 479, in __init__
self._read()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
self._dispatch(byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 508, in _dispatch
Dvi._dispatch(self, byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 546, in _fnt_def
Dvi._fnt_def(self, k, *args)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 372, in _fnt_def
self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 418, in __init__
nchars = max(tfm.width.iterkeys()) + 1
AttributeError: 'NoneType' object has no attribute 'width'

2010/12/13 Steve Nicholes <emailaddress_scn@...9...>:

Hello,

I recently upgraded matplotlib v0.98.5 to 1.0. Now when I try to plot data using latex for the figure labels my scripts fail. I have not changed my code so I'm not sure where the error is coming from. I have tried reinstalling and updating MikTex and Ghostscript but that has not helped (I'm running Windows 7 and Python 2.6). The actual error I get is below. Any thoughts?

It tries to find some .tfm font file from LaTeX via ``kpsewhich
<filename>``. The result of this might be '' (the empty string),
indicating that there was no output on stdout, meaning it couldn't run
``kpsewhich <filename>``. ``kpsewhich`` is used to find files on most
TeX distributions, but:

dviread.py:812:
    I hear MikTeX (a popular distribution on Windows)
    doesn't use kpathsea, so what do we do? (TODO)

Can you please try to find an executable ``kpsewhich`` or look for
some "kpathsea" keyword in the MikTeX docs, to find out if MikTeX uses
the kpathsea library to find files.

You said, it worked before, so maybe you have some PATH problem? Did
you change anything else besides the mpl version?

Friedrich

···

Traceback (most recent call last):
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4.py", line 215, in resizeEvent
self.draw()
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 130, in draw
FigureCanvasAgg.draw(self)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 394, in draw
self.figure.draw(self.renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 798, in draw
func(*args)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 1934, in draw
a.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 1017, in draw
tick.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\axis.py", line 236, in draw
self.label2.draw(renderer)
File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 524, in draw
bbox, info = self._get_layout(renderer)
File "C:\Python26\lib\site-packages\matplotlib\text.py", line 307, in _get_layout
ismath=ismath)
File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", line 171, in get_text_width_height_descent
renderer=self)
File "C:\Python26\lib\site-packages\matplotlib\texmanager.py", line 608, in get_text_width_height_descent
page = iter(dvi).next()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 65, in __iter__
have_page = self._read()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
self._dispatch(byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 370, in _fnt_def
vf = _vffile(n[-l:])
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 871, in _vffile
return _fontfile(texname, Vf, '.vf', _vfcache)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 860, in _fontfile
result = class_(filename)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 479, in __init__
self._read()
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 121, in _read
self._dispatch(byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 508, in _dispatch
Dvi._dispatch(self, byte)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 209, in _dispatch
self._fnt_def(k, c, s, d, a, l, n)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 546, in _fnt_def
Dvi._fnt_def(self, k, *args)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 372, in _fnt_def
self.fonts[k] = DviFont(scale=s, tfm=tfm, texname=n, vf=vf)
File "C:\Python26\lib\site-packages\matplotlib\dviread.py", line 418, in __init__
nchars = max(tfm.width.iterkeys()) + 1
AttributeError: 'NoneType' object has no attribute 'width'