Matplotlib import error

Ned Deily nad at acm.org
Fri Feb 6 22:04:43 EST 2015


In article 
<CAL2Y8-RVCoy-mBWAbgGqPkazo_xW-x4q0NTyG+A5sm19sg=xmQ at mail.gmail.com>,
 C Smith <illusiontechniques at gmail.com> wrote:
> I had python 2.7.6 installed on OS X yosemite, which has always worked
> fine, until I tried to install matplotlib with pip. I got the same
> error below and upgraded to 2.7.9, used pip to upgrade all the
> packages, but still get the same error.
> 
> >>> import matplotlib
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Library/Python/2.7/site-packages/matplotlib/__init__.py",
> line 180, in <module>
>     from matplotlib.cbook import is_string_like
>   File "/Library/Python/2.7/site-packages/matplotlib/cbook.py", line
> 33, in <module>

It looks like you have a mixture of packages, some left over from using 
the system Python 2.7 and, unfortunately, the system Python site-package 
directory is included at the sys.path search path for other Pythons, 
like the python.org Pythons.  If you plan to just use the Python 2.7.9, 
go to /Library/Python/2.7/site-packages and rm everything there.  Then 
use the 2.7.9 pip to install matplotlib.  It should download and install 
(to 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-pack
ages) the binary wheels for matplotlib and its dependencies, including 
numpy, and all just work.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list