Search code examples
macosgccpygraphviz

Installing pygraphviz on os 10.6.7 - python 2.6 (gcc-4.2 error)


I am trying to install pygraphviz on mac os 10.6.7. I am using python 2.6.

So far here is what I have done :

setup.py:

# OSX, Linux, alternate location
library_path='/usr/local/lib/graphviz'
include_path='/usr/local/include/graphviz'
  • Ran "python setup.py install"

but the process fails (see the code below) with the message : error: command 'gcc-4.2' failed with exit status 1

client126-234:pygraphviz francois$ python setup.py install
library_path=/usr/local/lib/graphviz
include_path=/usr/local/include/graphviz
running install
running build
running build_py
copying pygraphviz/version.py -> build/lib.macosx-10.6-universal-2.6/pygraphviz
running build_ext
building 'pygraphviz._graphviz' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict- 
prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/usr/local/include/graphviz 
-I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c 
pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.6-universal-2.6/pygraphviz/graphviz_wrap.o
unable to execute gcc-4.2: No such file or directory
error: command 'gcc-4.2' failed with exit status 1

I have tried :

  • to unstall an reinstall Graphviz
  • install the development version of Graphviz
  • download pygraphviz from python package index (http://pypi.python.org/pypi/pygraphviz) and install again
  • other installation ways : easy_install pygraphviz (give me the same error) . macport (impossible to install on my computer)

Am I doing something wrong? How can I solved this kind of error?

Any ideas would be a great help,

Thanks a lot

Francois


Solution

  • gcc-4.2 is part of Apple's developers tools package, Xcode. You need to install it first. There should be an Xcode 3 installer with either the software restore DVD that came with your Mac or possibly on the hard disk itself or with the Mac OS X 10.6 DVD or you can download a version from the Apple Developer Connection website (registration required) or you can buy a version of the newer Xcode 4 from the Mac Application Store. If you do install Xcode 4, you will likely need to add an export ARCHFLAGS='-arch i386 -arch x86_64' to your install; see here for more info.