title: matplotlib rc('text', usetex=True) producing errors
body: <p>I'm having trouble getting latex rendering to work with matplotlib. I've followed all the tips mentioned in the troubleshooting section of <a href="https://matplotlib.org/users/usetex.html" rel="nofollow noreferrer">https://matplotlib.org/users/usetex.html</a>, such as clearing <code>.matplotlib/tex.cache</code> and ensuring everything is on my Unix path, but to no avail. I'm using Spyder 3.2.8, Texlive 2018, Python 3.6, conda 4.5.4, Ghostscript 9.23 and dvipng 1.15. I'm using a 2012 Macbook Pro running MacOS 10.13.2. Below is a minimal working example. </p>
  
  <pre><code>import logging
  logging.basicConfig(level=logging.DEBUG)
  
  import matplotlib.pyplot as plt
  import numpy as np
  
  plt.close("all")
  plt.rc('text', usetex=True)
  
  x=np.arange(1,10)
  
  plt.plot(x,x)
  </code></pre>
  
  <p>This produces the overwhelming error output</p>
  
  <pre><code>DEBUG:matplotlib.texmanager:serif font is not compatible with usetex.
  INFO:matplotlib.texmanager:No LaTeX-compatible font found for the serif font family in rcParams. Using default.
  DEBUG:matplotlib.texmanager:sans-serif font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:sans-serif font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:family: sans-serif, font: Computer Modern Sans Serif, info: ('cmss', '')
  DEBUG:matplotlib.texmanager:cursive font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:cursive font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:family: cursive, font: Zapf Chancery, info: ('pzc', '\\usepackage{chancery}')
  DEBUG:matplotlib.texmanager:monospace font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:monospace font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:family: monospace, font: Computer Modern Typewriter, info: ('cmtt', '')
  DEBUG:matplotlib.texmanager:following keys changed: ['text.latex.preamble', 'font.family', 'font.serif', 'font.sans-serif', 'font.cursive', 'font.monospace']
  DEBUG:matplotlib.texmanager:text.latex.preamble : None       -&gt; []        
  DEBUG:matplotlib.texmanager:font.family         : None       -&gt; ['serif'] 
  DEBUG:matplotlib.texmanager:font.serif          : None       -&gt; ['Times New Roman']
  DEBUG:matplotlib.texmanager:font.sans-serif     : None       -&gt; ['DejaVu Sans', 'Bitstream Vera Sans', 'Computer Modern Sans Serif', 'Lucida Grande', 'Verdana', 'Geneva', 'Lucid', 'Arial', 'Helvetica', 'Avant Garde', 'sans-serif']
  DEBUG:matplotlib.texmanager:font.cursive        : None       -&gt; ['Apple Chancery', 'Textile', 'Zapf Chancery', 'Sand', 'Script MT', 'Felipa', 'cursive']
  DEBUG:matplotlib.texmanager:font.monospace      : None       -&gt; ['DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Computer Modern Typewriter', 'Andale Mono', 'Nimbus Mono L', 'Courier New', 'Courier', 'Fixed', 'Terminal', 'monospace']
  DEBUG:matplotlib.texmanager:RE-INIT
  old fontconfig: serifcmrcmsspzccmttd41d8cd98f00b204e9800998ecf8427e
  DEBUG:matplotlib.texmanager:serif font is not compatible with usetex.
  INFO:matplotlib.texmanager:No LaTeX-compatible font found for the serif font family in rcParams. Using default.
  DEBUG:matplotlib.texmanager:sans-serif font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:sans-serif font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:family: sans-serif, font: Computer Modern Sans Serif, info: ('cmss', '')
  DEBUG:matplotlib.texmanager:cursive font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:cursive font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:family: cursive, font: Zapf Chancery, info: ('pzc', '\\usepackage{chancery}')
  DEBUG:matplotlib.texmanager:monospace font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:monospace font is not compatible with usetex.
  DEBUG:matplotlib.texmanager:family: monospace, font: Computer Modern Typewriter, info: ('cmtt', '')
  DEBUG:matplotlib.texmanager:fontconfig: serifcmrcmsspzccmttd41d8cd98f00b204e9800998ecf8427e
  DEBUG:matplotlib.texmanager:fontconfig: serifcmrcmsspzccmttd41d8cd98f00b204e9800998ecf8427e
  DEBUG:matplotlib.texmanager:['latex', '-interaction=nonstopmode', '--halt-on-error', '/Users/Ewan/.matplotlib/tex.cache/c63236ff577e7f75eb3a0878a3cae5b8.tex']
  Traceback (most recent call last):
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py", line 519, in _draw_idle
      self.draw()
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 433, in draw
      self.figure.draw(self.renderer)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
      return draw(artist, renderer, *args, **kwargs)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/figure.py", line 1475, in draw
      renderer, self, artists, self.suppressComposite)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
      a.draw(renderer)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
      return draw(artist, renderer, *args, **kwargs)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_base.py", line 2607, in draw
      mimage._draw_list_compositing_images(renderer, self, artists)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/image.py", line 141, in _draw_list_compositing_images
      a.draw(renderer)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/artist.py", line 55, in draw_wrapper
      return draw(artist, renderer, *args, **kwargs)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/axis.py", line 1192, in draw
      renderer)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/axis.py", line 1130, in _get_tick_bboxes
      extent = tick.label1.get_window_extent(renderer)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/text.py", line 922, in get_window_extent
      bbox, info, descent = self._get_layout(self._renderer)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/text.py", line 309, in _get_layout
      ismath=ismath)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 232, in get_text_width_height_descent
      s, fontsize, renderer=self)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py", line 501, in get_text_width_height_descent
      dvifile = self.make_dvi(tex, fontsize)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py", line 365, in make_dvi
      texfile], tex)
    File "/Users/Ewan/anaconda3/lib/python3.6/site-packages/matplotlib/texmanager.py", line 335, in _run_checked_subprocess
      stderr=subprocess.STDOUT)
    File "/Users/Ewan/anaconda3/lib/python3.6/subprocess.py", line 336, in check_output
      **kwargs).stdout
    File "/Users/Ewan/anaconda3/lib/python3.6/subprocess.py", line 403, in run
      with Popen(*popenargs, **kwargs) as process:
    File "/Users/Ewan/anaconda3/lib/python3.6/subprocess.py", line 709, in __init__
      restore_signals, start_new_session)
    File "/Users/Ewan/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'latex': 'latex'
  </code></pre>
  
  <p>EDIT 1: The same code runs fine when called from the command line, and even renders latex correctly when </p>
  
  <pre><code>plt.xlabel("$\int_0^1 \sin(\\alpha)$")
  plt.show()
  </code></pre>
  
  <p>is appended to the end of the example above. Is the problem therefore Spyder? Can Spyder fail to find Latex even when its on my PATH? </p>