diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index 40fe207b4684..6ae2867b00a9 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -309,9 +309,13 @@ def __init__(self): self.texcommand = get_texcommand() self.latex_header = LatexManager._build_latex_header() latex_end = "\n\\makeatletter\n\\@@end\n" - latex = subprocess.Popen([self.texcommand, "-halt-on-error"], - stdin=subprocess.PIPE, stdout=subprocess.PIPE, - cwd=self.tmpdir) + try: + latex = subprocess.Popen([self.texcommand, "-halt-on-error"], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + cwd=self.tmpdir) + except OSError: + raise RuntimeError("Error starting process '%s'" % self.texcommand) test_input = self.latex_header + latex_end stdout, stderr = latex.communicate(test_input.encode("utf-8")) if latex.returncode != 0: