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!

2
  • 1
    This related question might help Commented Sep 21, 2013 at 23:04
  • are you using the same python you install matplotlib with? Commented Sep 22, 2013 at 5:48

1 Answer 1

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 :)

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.