Matplotlib cannot find basic fonts Matplotlib cannot find basic fonts python python

Matplotlib cannot find basic fonts


To get it to work, I had to combine the two current top answers. Here's what worked for me:

$ sudo apt install msttcorefonts -qq$ rm ~/.cache/matplotlib -rf


I had this exact same problem on a Vagrant VM running Ubuntu Xenial 64-bit. No matter how many fonts I had already installed, matplotlib was having a problem with the "system" font name "sans-serif". I fixed it by:

  • Stopping Jupyter
  • Installing font-manager: sudo apt install font-manager
  • Cleaning the matplotlib cache directory: rm ~/.cache/matplotlib -fr
  • Restarting Jupyter.

No more error messages about sans-serif.


This work for me::

$ sudo apt-get install msttcorefonts -qq