Help - Error using Latex font in Matplotlil (Anaconda, Python 3.6)
I tried for hours to find a solution to my problem but I was not able to get anywhere. I finally decided to write a mail here.
I’m an Italian engineer student using matplotlib for my master thesis. I would like to print some figures with Matplotlib using a Latex font. I looked everywhere in the internet for simular problems, but no solution was posted.
I’m trying to run the test code demo_tex.py which I found at http://matplotlib.org/users/usetex.html, but i get the following huge error (in blue). This is the first time I have an error using Matplotlib, it has always worked perfectly.
FileNotFoundError: [Errno 2] No such file or directory: 'latex': 'latex'
<Figure size 432x288 with 1 Axes>
I don’t understand why. I tried to do everything that was reported in the site. I’m using Matplotlib version 2.2.2, on Python version 3.6, launched from Spyder 3.2.8, lauched from Anaconda (Anaconda Navigator 1.8.7).
Some other useful information:
Operating system: macOS High Sierra version 10.13.5 (MacBook Pro). The result of name -a is:
Darwin MacBook-Pro-di-Filippo-3.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
My matplotlib configuration and cache directories are both located in '/Users/Filippo/.matplotlib’, where I also tried to remove the file tex.cache (without any success).
I obtained Matplotlib from Anaconda, I didn’t add any customizations to my matplotlibrc (in fact, I don’t know how to use matplotlilrc).
I installed Latex using the latest version of MacTex and TexMaker. I verified that dvipng was installed too. I used home-brew to install the latest version of ghostscript (9.23). Ghostscript is now installed in the following location:
These are the locations of the previous files:
I’m not really sure if latex, dvipng and ghostscript are really working on my PATH. They work whenever I call them from the command line, as in the following example:
I don’t know if this was useful but I tried to link them to my PATH modifying my .bash_profile in the following way (I have the same error using Matplotlib even If don’t link them in this way)(Anaconda wrote automatically the first two lines when I installed it):
I tried to do everything that I could, but I still unable to run Matplotlib and have a Latex font.