Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Symbol not found: _CGAffineTransformIdentity on MacOS 10.6 #1791

Merged
merged 1 commit into from

3 participants

@astrofrog

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/pyplot.py", 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/__init__.py", line 25, in pylab_setup
    globals(),locals(),[backend_name])
  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/backend_macosx.py", 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/_macosx.so, 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/_macosx.so
  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/_macosx.so

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/__init__.py", line 113, in <module>
    import pyparsing
  File "/Users/tom/Library/Python/2.7/lib/python/site-packages/pyparsing-1.5.3-py2.7.egg/pyparsing.py", line 629
    nonlocal limit,foundArity
                 ^
SyntaxError: invalid syntax

but I'll report that to the pyparsing developers.

@astrofrog

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

Processing pyparsing-2.0.0.zip
Writing /var/folders/8L/8L-R-5PbEh0ef6pKH-3E5k+++TI/-Tmp-/easy_install-VocUxa/pyparsing-2.0.0/setup.cfg
Running pyparsing-2.0.0/setup.py -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/pyparsing.py', 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/pyparsing.py', 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.

@pelson
Collaborator

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.

@astrofrog

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

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

@mdboom
Owner

Just a note to someone trying to track down this bug -- I would compare the compiler arguments when building the _macosx.so 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...

@astrofrog

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

@astrofrog

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/_macosx.so

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/_macosx.so -framework Cocoa

That's quite a big difference!

@astrofrog

It looks like

-framework Cocoa

is now missing - could it be that?

@mdboom
Owner

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

@astrofrog

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.

@mdboom
Owner

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  setupext.py
View
1  setupext.py
@@ -1540,6 +1540,7 @@ def get_extension(self):
Numpy().add_flags(ext)
LibAgg().add_flags(ext)
CXX().add_flags(ext)
+ ext.extra_link_args.extend(['-framework', 'Cocoa'])
return ext
Something went wrong with that request. Please try again.