15

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.

Community
  • 1
  • 1
hgbauer
  • 151
  • 1
  • 1
  • 4
  • 2
    `mv ~/.matplotlib/ ~/.matplotlib_old` restart python, and if it works you remove `~/.matplotlib/` – ilciavo Nov 25 '16 at 15:29

2 Answers2

12

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.

Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
welch
  • 936
  • 8
  • 12
8

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

tmdavison
  • 64,360
  • 12
  • 187
  • 165