2

I installed matplotlib on Mac and it was successful. After I type in

import matplotlib.pyplot as plt

in my code I got the following error:

Traceback (most recent call last):
File "q2.py", line 5, in <module>
import matplotlib.pyplot as plt
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/pyplot.py", line 26, in <module>
import matplotlib.colorbar
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/colorbar.py", line 31, in <module>
import matplotlib.artist as martist
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/artist.py", line 10, in <module>
from .transforms import Bbox, IdentityTransform, TransformedBbox, \
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/transforms.py", line 38, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.8-intel.egg/matplotlib/_path.so, 2): Symbol not found: ___emutls_get_address
Referenced from: /usr/local/lib/libstdc++.6.dylib
Expected in: /usr/local/lib/libgcc_s.1.dylib
in /usr/local/lib/libstdc++.6.dylib

I followed the installation instruction in the link below:

https://github.com/matplotlib/matplotlib/blob/master/README.osx

The installation has no problem. Does anyone know why this would happen?

Thanks!

esdotzed
  • 498
  • 1
  • 7
  • 22

1 Answers1

1

I know this question is a bit stale, but I recently ran into the same issue and couldn't find a solution online. I figured my debugging might help someone else out there...

Apparently there's an incompatibility with the libgcc_s.1.dylib and libstdc++.6.dylib libraries found in /usr/local/lib/. I backed up those files, and then sym linked from the files found in /usr/lib/

sudo mv /usr/local/lib/libgcc_s.1.dylib /usr/local/lib/libgcc_s.1.dylib.old
sudo mv /usr/local/lib/libstdc++.6.dylib /usr/local/lib/libstdc++.6.dylib.old

sudo ln -s /usr/lib/libgcc_s.1.dylib /usr/local/lib/libgcc_s.1.dylib
sudo ln -s /usr/lib/libstdc++.6.dylib /usr/local/lib/libstdc++.6.dylib

I'm now able to import pyplot :)

Steve Bond
  • 229
  • 2
  • 5
  • Excellent. I was getting this error `ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Symbol not found: ___emutls_get_address Referenced from: /usr/local/lib/libstdc++.6.dylib Expected in: /usr/lib/libSystem.B.dylib in /usr/local/lib/libstdc++.6.dylib` and moving and linking the `libstdc++` dylibs in your answer fixed it. – AGS Feb 06 '15 at 03:21