[cairo] pycairo on OSX: "ImportError: no suitable image found"

Ian York iayork at iayork.com
Sat Nov 20 17:43:02 PST 2010

I'm trying to install pycairo 1.8.10 on my macbook pro (2.66 GHz Intel Core 2 Duo running MacOS 10.6.5), and pycairo is getting installed but not in a usable way. I get this error message:

~ > /usr/bin/python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/cairo/__init__.py", line 1, in <module>
    from _cairo import *
ImportError: dlopen(/Library/Python/2.6/site-packages/cairo/_cairo.so, 2): no suitable image found.  Did find:
	/Library/Python/2.6/site-packages/cairo/_cairo.so: mach-o, but wrong architecture


Installation looks to me like it should be reading correctly (after making sure it was looking in my framework install and not opt/local):
~/Downloads/pycairo-1.8.10 >  ./waf configure --prefix='/System/Library/Frameworks/Python.framework/Versions/2.6'
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for gcc                         : ok  
Checking for program python              : /usr/bin/python 
Checking for Python version >= 2.6.0     : ok 2.6.1 
Checking for library python2.6           : yes 
Checking for program python2.6-config    : /usr/bin/python2.6-config 
Checking for header Python.h             : yes 
Checking for cairo >= 1.8.10             : yes 
'configure' finished successfully (0.593s)
~/Downloads/pycairo-1.8.10 > ./waf build
Waf: Entering directory `/Users/iayork/Downloads/pycairo-build'
[1/9] cc: src/cairomodule.c -> ../pycairo-build/default/src/cairomodule_2.o
[2/9] cc: src/context.c -> ../pycairo-build/default/src/context_2.o
[3/9] cc: src/font.c -> ../pycairo-build/default/src/font_2.o
[4/9] cc: src/path.c -> ../pycairo-build/default/src/path_2.o
[5/9] cc: src/pattern.c -> ../pycairo-build/default/src/pattern_2.o
[6/9] cc: src/matrix.c -> ../pycairo-build/default/src/matrix_2.o
[7/9] cc: src/surface.c -> ../pycairo-build/default/src/surface_2.o
[8/9] copy: pycairo.pc.in -> ../pycairo-build/default/pycairo.pc
[9/9] cc_link: ../pycairo-build/default/src/cairomodule_2.o ../pycairo-build/default/src/context_2.o ../pycairo-build/default/src/font_2.o ../pycairo-build/default/src/path_2.o ../pycairo-build/default/src/pattern_2.o ../pycairo-build/default/src/matrix_2.o ../pycairo-build/default/src/surface_2.o -> ../pycairo-build/default/src/_cairo.so
Waf: Leaving directory `/Users/iayork/Downloads/pycairo-build'
'build' finished successfully (2.040s)
(Followed by install, of course) Any suggestions?



    Ian York   (iayork at iayork.com)  <http://www.iayork.com/>
 "-but as he was a York, I am rather inclined to suppose him a
  very respectable Man." -Jane Austen, The History of England

More information about the cairo mailing list