Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with "Matplotlib is building the font cache using fc-list. This may take a moment." on MacoS

I am running OS X 10.11.3, and I have installed Anaconda3-2.5.0-MacOSX-x86_64.pkg which includes Matplotlib 1.5.1. When I try to import Matplotlib in Jupyter with the following:

import matplotlib.pyplot as pp

I get a very long error message, beginning with the following:

/Users/hgbauer/anaconda/lib/python3.5/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.

The message never goes away, no matter how long I wait.

I’ve noticed in a related thread:

matplotlib taking time when being imported

that the problem may require deleting the contents of ~/.cache/matplotlib, but in that situation, Matplotlib seems to have been installed separately rather than as a part of Anaconda.

My question is this:

How can I access the ~/.cache/matplotlib file in Anaconda in order to delete the contents?

Any suggestions would be very much appreciated.

like image 242
hgbauer Avatar asked Mar 01 '16 21:03

hgbauer


2 Answers

The files to be removed are under ~/.matplotlib, rather than ~/.cache/matplotlib (you'll also want to remove ~/.cache/fontconfig out of superstition, but the wrong .matplotlib path was the big thing)

You should see that pesky message again on your next run, then no more.

like image 180
welch Avatar answered Sep 27 '22 23:09

welch


You can find this out with get_cachedir(). For example in python 2:

import matplotlib as mpl
print mpl.get_cachedir()

and in python 3:

import matplotlib as mpl
print(mpl.get_cachedir())

See here for more information

like image 35
tmdavison Avatar answered Sep 27 '22 23:09

tmdavison