On 10/22/2011 06:46 AM, Steve Butcher wrote:
> All,
>
> On my iMac at work running 10.6.8, I did a brew-based installation of
> Python 2.7.2. I used pip to install scipy, numpy and then matplotlib.
> The last didn't work right so I scoured the internets to find out what
> to do. The first solution I found suggested doing a git clone of the
> repository and running python setup.py build then python setup.py
> install. That worked just great.
>
> At home, I tried the same thing on my MBP running 10.6.8. When I got to
> the compile matplotlib step, the fix from above didn't work. So I
> started trying other solutions I had found. Many of them "worked",
> however, when I went to run this simple script:
>
> import matplotlib.pylab as plt
> from scipy.stats import norm
>
> I got this error:
>
> Traceback (most recent call last):
> File "plot.py", line 1, in <module>
> import matplotlib.pylab as plt
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/pylab.py",
> line 221, in <module>
> from matplotlib import mpl # pulls in most modules
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/mpl.py",
> line 2, in <module>
> from matplotlib import axis
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/axis.py",
> line 10, in <module>
> import matplotlib.font_manager as font_manager
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/font_manager.py",
> line 1323, in <module>
> _rebuild()
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/font_manager.py",
> line 1273, in _rebuild
> fontManager = FontManager()
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/font_manager.py",
> line 997, in __init__
> self.afmlist = createFontList(self.afmfiles, fontext='afm')
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/font_manager.py",
> line 565, in createFontList
> prop = afmFontProperty(fpath, font)
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/font_manager.py",
> line 501, in afmFontProperty
> weight = weight_as_number(font.get_weight().lower())
> File
> "/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/matplotlib-1.2.x-py2.7-macosx-10.4-x86_64.egg/matplotlib/afm.py",
> line 464, in get_weight
> return self._header['Weight']
> KeyError: 'Weight'
>
> Googling did not reveal a single occurrence of this error reported anywhere.
>
> And so I would move on to the next instructions for compilation
> including the original make.osx instructions...and while the
> compilations succeeded, I still got the same error. Finally I decided to
> try the Enthought completely pre-compiled and packaged installation.
> Same problem.
>
> I'm at a loss. I even completely erased my /usr/local/ directory so that
> everything would be consistently installed via Homebrew. But no matter
> what I do, I end up with the same problem.
>
> I'm considering that something is wrong with my Snow Leopard
> installation and perhaps (reluctantly) upgrading to Lion, something I
> haven't really felt compelled to do. I'm hoping that there is a setting
> that I neglected.
>
> Ideas?

Given that the error is appearing in afm.py, and that it is independent 
of the python and matplotlib installations, my guess is that there is a 
bad afm font file somewhere on your system--in which case, it is not 
clear that upgrading to Lion would help.  There is another thread on the 
mailing list right now about a possibly similar problem. Fonts and Macs 
are outside my domain, but with that caveat, I suggest that instead of 
"upgrading" you try comparing the the collection of fonts on your work 
machine to that on your home machine.  Maybe something you installed on 
your home machine included a bad font file that mpl is finding.

Eric

>
> Thanks,
> Steve
>
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Cisco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to