This is the log of the install process andre-girards-computer:pycairo-1.8.6 andre$ sudo python setup.py install Password: cairo >= 1.8.6 detected creating pycairo.pc running install running build running build_py creating build creating build/lib.macosx-10.3-fat-2.6 creating build/lib.macosx-10.3-fat-2.6/cairo copying cairo/__init__.py -> build/lib.macosx-10.3-fat-2.6/cairo running build_ext building 'cairo._cairo' extension creating build/temp.macosx-10.3-fat-2.6 creating build/temp.macosx-10.3-fat-2.6/cairo gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/cairomodule.c -o build/temp.macosx-10.3-fat-2.6/cairo/cairomodule.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/pycairo-context.c -o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-context.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/pycairo-font.c -o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-font.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/pycairo-matrix.c -o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-matrix.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/pycairo-path.c -o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-path.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/pycairo-pattern.c -o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-pattern.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/sw/include/cairo -I/sw/include/pixman-1 -I/sw/include/freetype2 -I/sw/include -I/sw/include/libpng12 -I/usr/X11R6/include -I/usr/X11/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c cairo/pycairo-surface.c -o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-surface.o gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/cairo/cairomodule.o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-context.o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-font.o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-matrix.o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-path.o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-pattern.o build/temp.macosx-10.3-fat-2.6/cairo/pycairo-surface.o -L/sw/lib -L/sw/lib -lcairo -o build/lib.macosx-10.3-fat-2.6/cairo/_cairo.so ld warning: in /sw/lib/libcairo.dylib, file is not of required architecture running install_lib creating /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/cairo copying build/lib.macosx-10.3-fat-2.6/cairo/__init__.py -> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/cairo copying build/lib.macosx-10.3-fat-2.6/cairo/_cairo.so -> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/cairo byte-compiling /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/cairo/__init__.py to __init__.pyc running install_data copying pycairo.pc -> /Library/Frameworks/Python.framework/Versions/2.6/lib/pkgconfig running install_egg_info Writing /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pycairo-1.8.6-py2.6.egg-info And then trying to use it andre-girards-computer:pycairo-1.8.6 andre$ python Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information. Starting pythonrc >>> import cairo Traceback (most recent call last): File "<stdin>", line 1, in <module> File "cairo/__init__.py", line 1, in <module> from _cairo import * ImportError: No module named _cairo
What directory are you in when you run Python ? If you are in the top-level pycairo directory then 'import cairo' will look in the ./cairo directory, find __init__.py, import it, and then complain "ImportError: No module named _cairo". This is unexpected behaviour resulting from Python using relative imports, and has caught me out a few times too. Try changing to another directory and then 'import cairo' and see if that works. [The 'cairo' directory should be renamed to 'src' prevent this problem]
On 4-Jul-09, at 11:34 PM, bugzilla-daemon@freedesktop.org wrote: > http://bugs.freedesktop.org/show_bug.cgi?id=22617 > > > > > > --- Comment #1 from Steve Chaplin <stevech1097@yahoo.com.au> > 2009-07-04 20:34:54 PST --- > What directory are you in when you run Python ? > > If you are in the top-level pycairo directory then 'import cairo' > will look in > the ./cairo directory, find __init__.py, import it, and then complain > "ImportError: No module named _cairo". > > This is unexpected behaviour resulting from Python using relative > imports, and > has caught me out a few times too. > > Try changing to another directory and then 'import cairo' and see if > that > works. Right. That was the problem. Thanks Andre Girard INRS-EMT & GERAD
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.