basic pgf test fails

Neal Becker wrote:

I tried the simple example, but all examples I try choke on savefig
('blah.pdf') This is fedora20 linux, with pretty modern, complete texlive.

I tried rm'ing tex-cache

---------------- example.py
# -*- coding: utf-8 -*-

import matplotlib as mpl
mpl.use("pgf")
pgf_with_rc_fonts = {
    "font.family": "serif",
    "font.serif": [], # use latex default serif font
    "font.sans-serif": ["DejaVu Sans"], # use a specific sans-serif font
}
mpl.rcParams.update(pgf_with_rc_fonts)

import matplotlib.pyplot as plt
plt.figure(figsize=(4.5,2.5))
plt.plot(range(5))
plt.text(0.5, 3., "serif")
plt.text(0.5, 2., "monospace", family="monospace")
plt.text(2.5, 2., "sans-serif", family="sans-serif")
plt.text(2.5, 1., "comic sans", family="Comic Sans MS")
plt.xlabel(u"µ is not $\\mu$")
plt.tight_layout(.5)
----------------------

python testpgf.py
/usr/lib64/python2.7/site-packages/matplotlib/__init__.py:758: UserWarning:
Found matplotlib configuration in ~/.matplotlib/. To conform with the XDG base
directory standard, this configuration location has been deprecated on Linux,
and the new location is now '/home/nbecker/.config'/matplotlib/. Please move
your configuration there to ensure that matplotlib will continue to find it in
the future.
  _get_xdg_config_dir())
Traceback (most recent call last):
  File "testpgf.py", line 20, in <module>
    plt.tight_layout(.5)
  File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 1255,
  in
tight_layout
    fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
  File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1600,
  in
tight_layout
    renderer = get_renderer(self)
  File "/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py", line
222, in get_renderer
    renderer = canvas.get_renderer()
  File
  "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 925, in get_renderer
    return RendererPgf(self.figure, None, dummy=True)
  File
  "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 409, in __init__
    self.latexManager = LatexManagerFactory.get_latex_manager()
  File
  "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 223, in get_latex_manager
    new_inst = LatexManager()
  File
  "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 305, in __init__
    cwd=self.tmpdir)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1308, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Figured it out. problem is xelatex was not installed. Too bad the traceback
can't be more clear on this.

Neal Becker wrote:

I tried the simple example, but all examples I try choke on savefig
('blah.pdf') This is fedora20 linux, with pretty modern, complete texlive.

I tried rm'ing tex-cache

---------------- example.py
# -*- coding: utf-8 -*-

import matplotlib as mpl
mpl.use("pgf")
pgf_with_rc_fonts = {
     "font.family": "serif",
     "font.serif": [], # use latex default serif font
     "font.sans-serif": ["DejaVu Sans"], # use a specific sans-serif font
}
mpl.rcParams.update(pgf_with_rc_fonts)

import matplotlib.pyplot as plt
plt.figure(figsize=(4.5,2.5))
plt.plot(range(5))
plt.text(0.5, 3., "serif")
plt.text(0.5, 2., "monospace", family="monospace")
plt.text(2.5, 2., "sans-serif", family="sans-serif")
plt.text(2.5, 1., "comic sans", family="Comic Sans MS")
plt.xlabel(u"µ is not $\\mu$")
plt.tight_layout(.5)
----------------------

python testpgf.py
/usr/lib64/python2.7/site-packages/matplotlib/__init__.py:758: UserWarning:
Found matplotlib configuration in ~/.matplotlib/. To conform with the XDG base
directory standard, this configuration location has been deprecated on Linux,
and the new location is now '/home/nbecker/.config'/matplotlib/. Please move
your configuration there to ensure that matplotlib will continue to find it in
the future.
   _get_xdg_config_dir())
Traceback (most recent call last):
   File "testpgf.py", line 20, in <module>
     plt.tight_layout(.5)
   File "/usr/lib64/python2.7/site-packages/matplotlib/pyplot.py", line 1255,
   in
tight_layout
     fig.tight_layout(pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
   File "/usr/lib64/python2.7/site-packages/matplotlib/figure.py", line 1600,
   in
tight_layout
     renderer = get_renderer(self)
   File "/usr/lib64/python2.7/site-packages/matplotlib/tight_layout.py", line
222, in get_renderer
     renderer = canvas.get_renderer()
   File
   "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 925, in get_renderer
     return RendererPgf(self.figure, None, dummy=True)
   File
   "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 409, in __init__
     self.latexManager = LatexManagerFactory.get_latex_manager()
   File
   "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 223, in get_latex_manager
     new_inst = LatexManager()
   File
   "/usr/lib64/python2.7/site-packages/matplotlib/backends/backend_pgf.py",
line 305, in __init__
     cwd=self.tmpdir)
   File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
     errread, errwrite)
   File "/usr/lib64/python2.7/subprocess.py", line 1308, in _execute_child
     raise child_exception
OSError: [Errno 2] No such file or directory

Figured it out. problem is xelatex was not installed. Too bad the traceback
can't be more clear on this.

This sounds like something that can be fixed quite easily in mpl, and that if not fixed is likely to trip up other people. Would you turn this into a github issue, please? Or, a PR?

Thank you.

Eric

···

On 2014/05/07 2:34 AM, Neal Becker wrote:

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users