Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Symbol not found: _CGAffineTransformIdentity on MacOS 10.6 #1791

merged 1 commit into from

3 participants


On MacOS 10.6, Matplotlib installs without error, but is then not importable:

Python 3.2.3 (default, Apr 13 2012, 00:15:25) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tom/Library/Python/3.2/lib/python/site-packages/matplotlib-1.3.x-py3.2-macosx-10.6-x86_64.egg/matplotlib/", line 98, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Users/tom/Library/Python/3.2/lib/python/site-packages/matplotlib-1.3.x-py3.2-macosx-10.6-x86_64.egg/matplotlib/backends/", line 25, in pylab_setup
  File "/Users/tom/Library/Python/3.2/lib/python/site-packages/matplotlib-1.3.x-py3.2-macosx-10.6-x86_64.egg/matplotlib/backends/", line 21, in <module>
    from matplotlib.backends import _macosx
ImportError: dlopen(/Users/tom/Library/Python/3.2/lib/python/site-packages/matplotlib-1.3.x-py3.2-macosx-10.6-x86_64.egg/matplotlib/backends/, 2): Symbol not found: _CGAffineTransformIdentity
  Referenced from: /Users/tom/Library/Python/3.2/lib/python/site-packages/matplotlib-1.3.x-py3.2-macosx-10.6-x86_64.egg/matplotlib/backends/
  Expected in: flat namespace
 in /Users/tom/Library/Python/3.2/lib/python/site-packages/matplotlib-1.3.x-py3.2-macosx-10.6-x86_64.egg/matplotlib/backends/

On Python 2.7, pyparsing doesn't even work:

>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tom/Library/Python/2.7/lib/python/site-packages/matplotlib-1.3.x-py2.7-macosx-10.6-x86_64.egg/matplotlib/", line 113, in <module>
    import pyparsing
  File "/Users/tom/Library/Python/2.7/lib/python/site-packages/pyparsing-1.5.3-py2.7.egg/", line 629
    nonlocal limit,foundArity
SyntaxError: invalid syntax

but I'll report that to the pyparsing developers.


Regarding the pyparsing bug, the reason it's using 1.5.3 is because 2.0.0 fails to install during the matplotlib install:

Writing /var/folders/8L/8L-R-5PbEh0ef6pKH-3E5k+++TI/-Tmp-/easy_install-VocUxa/pyparsing-2.0.0/setup.cfg
Running pyparsing-2.0.0/ -q bdist_egg --dist-dir /var/folders/8L/8L-R-5PbEh0ef6pKH-3E5k+++TI/-Tmp-/easy_install-VocUxa/pyparsing-2.0.0/egg-dist-tmp-XdiKmp
SyntaxError: ('invalid syntax', ('build/bdist.macosx-10.6-x86_64/egg/', 629, 22, '        nonlocal limit,foundArity\n'))

zip_safe flag not set; analyzing archive contents...
SyntaxError: ('invalid syntax', ('/Users/tom/Library/Python/2.7/lib/python/site-packages/pyparsing-1.5.3-py2.7.egg/', 629, 22, '        nonlocal limit,foundArity\n'))

Adding pyparsing 1.5.3 to easy-install.pth file

Installed /Users/tom/Library/Python/2.7/lib/python/site-packages/pyparsing-1.5.3-py2.7.egg
error: Could not find required distribution pyparsing>=1.5.6

But in any case, that's a separate issue.


Thanks @astrofrog - I'm guessing this is new in the last day or so and this is a result of the change in #1454?

I don't think you're after a workaround, but if you were (or somebody else who finds this is) it is probably possible to change the backend in matplotlibrc and avoid this message.


@pelson - thanks - just to confirm, I also see this on Python 2.

I opened a separate issue for the pyparsing issue (#1792).


Just a note to someone trying to track down this bug -- I would compare the compiler arguments when building the extension prior to commit 7940245 vs. now. Something is probably missing in the new version -- and the setup rework probably did not get enough mac testing. I might be able to get on a Mac later this afternoon...


I can try and provide you with the compiler arguments - let me check.


At 7940245 (after):

/usr/bin/g++-4.2 -bundle -undefined dynamic_lookup -L/opt/local/lib build/temp.macosx-10.6-x86_64-2.7/src/_macosx.o build/temp.macosx-10.6-x86_64-2.7/src/agg_py_transforms.o build/temp.macosx-10.6-x86_64-2.7/src/path_cleanup.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_bezier_arc.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_curves.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_image_filters.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_trans_affine.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_vcgen_contour.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_vcgen_dash.o build/temp.macosx-10.6-x86_64-2.7/agg24/src/agg_vcgen_stroke.o build/temp.macosx-10.6-x86_64-2.7/CXX/cxx_extensions.o build/temp.macosx-10.6-x86_64-2.7/CXX/cxxsupport.o build/temp.macosx-10.6-x86_64-2.7/CXX/IndirectPythonInterface.o build/temp.macosx-10.6-x86_64-2.7/CXX/cxxextensions.o -L/usr/local/lib -L/usr/lib -L/usr/X11/lib -L/opt/local/lib -lstdc++ -lm -o build/lib.macosx-10.6-x86_64-2.7/matplotlib/backends/

At 1cc6507 (before):

/usr/bin/g++-4.2 -bundle -undefined dynamic_lookup -L/opt/local/lib build/temp.macosx-10.6-x86_64-2.7/src/_macosx.o build/temp.macosx-10.6-x86_64-2.7/CXX/cxx_extensions.o build/temp.macosx-10.6-x86_64-2.7/CXX/cxxextensions.o build/temp.macosx-10.6-x86_64-2.7/CXX/cxxsupport.o build/temp.macosx-10.6-x86_64-2.7/CXX/IndirectPythonInterface.o build/temp.macosx-10.6-x86_64-2.7/src/agg_py_transforms.o build/temp.macosx-10.6-x86_64-2.7/src/path_cleanup.o -L/usr/local/lib -L/usr/lib -L/usr/X11/lib -L/opt/local/lib -lstdc++ -lm -o build/lib.macosx-10.6-x86_64-2.7/matplotlib/backends/ -framework Cocoa

That's quite a big difference!


It looks like

-framework Cocoa

is now missing - could it be that?


I think that's exactly it. Would you mind testing the attached patch?


This fixes the issue - thanks!

By the way, any luck with getting Matplotlib on Shining Panda? I could set up a build on my local Jenkins Mac and publish to a remote Jenkins to catch this kind of issue early.


We're in the process of setting up the funding for Shining Panda for matplotlib. Stay tuned!

@mdboom mdboom merged commit 54b9e76 into matplotlib:master

1 check passed

Details default The Travis build passed
@mdboom mdboom deleted the mdboom:fix-macosx-build branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 27, 2013
  1. @mdboom
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0 
1 
@@ -1540,6 +1540,7 @@ def get_extension(self):
+ ext.extra_link_args.extend(['-framework', 'Cocoa'])
return ext
Something went wrong with that request. Please try again.