Reputation: 564
I am trying to run the following example code in EPD 7.3-2 (64-bit) on OS X:
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
mu, sigma = 100, 15
x = mu + sigma*np.random.randn(10000)
n, bins, patches = plt.hist(x, 50, normed=1, alpha=0.75)
y = mlab.normpdf( bins, mu, sigma)
l = plt.plot(bins, y, 'r--', linewidth=1)
plt.xlabel('Smarts')
plt.ylabel('Probability')
plt.title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
plt.axis([40, 160, 0, 0.03])
plt.grid(True)
plt.show()
The last line gives me an error:
RuntimeError: Could not open facefile /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf; Cannot_Open_Resource
There are two things I don't understand. First, that Vera.ttf file IS there in the specified location, so I don't know why Python can't open it.
Second, I don't understand why it's looking there at all. My EPD matplotlib installation is at /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib. Why wouldn't it be looking there for Vera.ttf? It does exist in /Library/Frameworks/EPD64.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/mpl-data/fonts/ttf. And there are no 2.6 directories listed in sys.path, only the expected EPD 2.7 directories are listed there. Finally, my PATH environment variable is /Library/Frameworks/EPD64.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin.
Upvotes: 0
Views: 680
Reputation: 3173
This sounds like an issue with Matplotlib's font caching. Could you try the suggestions in this related post: https://stackoverflow.com/a/4956933/260303
In short, just delete the font cache in the config directory: rm ~/.matplotlib/fontList.cache
.
Upvotes: 2