0

What I have understood since trying to fix this is that I installed matplotlib but python does not utilize it to plot something.

I encountered some error messages like this:

from matplotlib import pyplot
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", line 28, in <module>
    import matplotlib.colorbar
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/colorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backend_bases.py", line 61, in <module>
    import matplotlib.textpath as textpath
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/textpath.py", line 15, in <module>
    import matplotlib.font_manager as font_manager
  File "/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/font_manager.py", line 58, in <module>
    from matplotlib import ft2font
ImportError: dlopen(/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/ft2font.so, 2): Library not loaded: libfreetype.6.dylib
  Referenced from: /Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib/ft2font.so
  Reason: image not found

I googled image not found error, matplotlib reinstall and etc... but nothing has worked.

Does this have something to do with version of os x? I am using yosemite.

  • 1
    `I installed matplotlib` - you may want to be a little more explicit here. How did you install it? Also `nothing has worked` is not very helpful information. – cel Aug 13 '15 at 07:37

1 Answers1

-1

Here information.

>>> import pkgutil
>>> package = pkgutil.get_loader("matplotlib")
>>> package.filename
'/usr/local/lib/python2.7/dist-packages/matplotlib'
>>> 

So where your "matplotlib" ?

COPY :

/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-p‌‌​​y2.7-macosx-10.5-x86_64.egg

TO : /usr/local/lib/python2.7/site-packages/ OR TO:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/
Community
  • 1
  • 1
dsgdfg
  • 1,492
  • 11
  • 18
  • `'/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-py2.7-macosx-10.5-x86_64.egg/matplotlib'` here is what I saw by using the code above – Expert in asking Aug 13 '15 at 07:03
  • Our directory are not the same. The system uses a common library directories. Try to copy with the rankings the correct directory /usr/local/. – dsgdfg Aug 13 '15 at 07:18
  • I don't get it. Do you mean that I need to reinstall python in the directory /usr/local/? – Expert in asking Aug 13 '15 at 07:23
  • No. Only check /usr/local/anaconda/lib/python2.7/site-packages/ If there is one: copy '/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-p‌​y2.7-macosx-10.5-x86_64.egg TO /usr/local/anaconda/lib/python2.7/site-packages/ – dsgdfg Aug 13 '15 at 07:29
  • Oh, there's no folder /usr/local/anaconda/lib/python2.7/site-packages/ – Expert in asking Aug 13 '15 at 07:31
  • OK ! COPY: '/Users/changhyunahn/anaconda/lib/python2.7/site-packages/matplotlib-1.5.dev1-p‌​y2.7-macosx-10.5-x86_64.egg TO /usr/local/lib/python2.7/site-packages/ – dsgdfg Aug 13 '15 at 07:36
  • I have /usr/local/lib/, but no python2.7 folder in lib at all. – Expert in asking Aug 13 '15 at 07:39
  • Oh, now I figure out what you intended me to do. I found an executable file python in `/usr/bin/`. I run it and type to code you suggested above. Then it showed me up `'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib'`. matplotlib module works well at this environment. The problem is, when I run a python(I just typed python on terminal), it is not the one that inherently built in system but is in anaconda. I want to set a default python as this one and get rid of anaconda. How can I do this? – Expert in asking Aug 13 '15 at 07:52
  • Anconda ask "change path" but you missed it. Reinstall anaconda (gui installer) with "change path" argument. i am sorry (using ubuntu).(more export path command but i am not sure...) – dsgdfg Aug 13 '15 at 07:57