Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matplotlib gives useless error message when latex not installed #4475

Closed
samtygier opened this issue May 26, 2015 · 3 comments
Closed

Matplotlib gives useless error message when latex not installed #4475

samtygier opened this issue May 26, 2015 · 3 comments
Assignees
Milestone

Comments

@samtygier
Copy link
Contributor

Version 1.4.3 on Fedora 22 Linux.

After reinstalling my OS, and running a script that previously worked I got the error below. I have tried to extract a simple test case, but I can't figure out what exactly triggers the error. Installing texlive fixed it. It would be really nice if I just got a "Latex is not installed" error.

Traceback (most recent call last):
  File "./make_plot.py", line 143, in <module>
    srange=srange, namefunc=iscollimator, fname=plot_name, title=name)
  File "/home/sam/physicstmp/lhc_collimation/plot_tools/20150526/plottfs.py", line 313, in plot_twiss
    pyplot.savefig(fname, dpi=300)
  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 577, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1476, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backend_bases.py", line 2211, in print_figure
    **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.py", line 2485, in print_pdf
    self.figure.draw(renderer)
  File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1085, in draw
    func(*args)
  File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/axes/_base.py", line 2110, in draw
    a.draw(renderer)
  File "/usr/lib64/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/matplotlib/axis.py", line 1116, in draw
    renderer)
  File "/usr/lib64/python2.7/site-packages/matplotlib/axis.py", line 1065, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File "/usr/lib64/python2.7/site-packages/matplotlib/text.py", line 798, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File "/usr/lib64/python2.7/site-packages/matplotlib/text.py", line 311, in _get_layout
    ismath=False)
  File "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pdf.py", line 2044, in get_text_width_height_descent
    renderer=self)
  File "/usr/lib64/python2.7/site-packages/matplotlib/texmanager.py", line 673, in get_text_width_height_descent
    page = next(iter(dvi))
  File "/usr/lib64/python2.7/site-packages/matplotlib/dviread.py", line 89, in __iter__
    have_page = self._read()
  File "/usr/lib64/python2.7/site-packages/matplotlib/dviread.py", line 150, in _read
    self._dispatch(byte)
  File "/usr/lib64/python2.7/site-packages/matplotlib/dviread.py", line 238, in _dispatch
    self._fnt_def(k, c, s, d, a, l, n)
  File "/usr/lib64/python2.7/site-packages/matplotlib/dviread.py", line 399, in _fnt_def
    if c != 0 and tfm.checksum != 0 and c != tfm.checksum:
AttributeError: 'NoneType' object has no attribute 'checksum'
@tacaswell tacaswell added this to the next point release milestone May 26, 2015
@tacaswell
Copy link
Member

fair point.

@mdboom
Copy link
Member

mdboom commented May 26, 2015

Puzzling. matplotlib already at least tries to check for latex and give a helpful message:

https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/__init__.py#L462

So something about that is failing in this context.

@jkseppan
Copy link
Member

If it gets that far into the code, LaTeX is installed, but the font metrics are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants