I was trying to run

matplotlib.rcParams['text.usetex'] = True
matplotlib.rcParams['font.family'] = 'serif'

on python, but I received the following error

FileNotFoundError: [Errno 2] No such file or directory: 'latex': 'latex'

Then I tried

import subprocess

and again, I got

FileNotFoundError: [Errno 2] No such file or directory: 'latex': 'latex'

so I went ahead and tried

whereis latex

on terminal and got no response. So I thought I might not have LaTeX installed, but then I realized I do have LaTeXiT software installed on my mac which works perfectly fine, so I should have LaTeX on my mac. I was wondering if anyone has any suggestions to solve the issue.


I have been experiencing this problem once in a while and I feel that there is no comprehensive answer for it. I'm looking for an answer that can run

import subprocess

for the starters.

  • You might have pdflatex installed instead. – timothymctim Aug 13 '19 at 14:45
  • I tried whereis pdflatex but no outputs – Blade Aug 13 '19 at 14:49
  • I’m unfamiliar with the tool you mentioned, but it seems that under Preferences > Typesetting > Behaviour you might find where the binaries are located. Source: osksn2.hep.sci.osaka-u.ac.jp/~taku/osx/feynmp_latexit.html – timothymctim Aug 13 '19 at 14:58
  • There it is, it's TeXlive. Thanks! – Blade Aug 13 '19 at 15:02
  • The TeXLive bin will have latex as well as many other binaries. You'll need to make sure that directory is in your path. – Teepeemm Aug 13 '19 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.