Installation on Mac OS X

2,019 views
Skip to first unread message

Bertil

unread,
Feb 17, 2009, 10:52:26 PM2/17/09
to pygraphviz-discuss
I've tried all day and most of the night, and I can't find a way to
install pygraphviz with Mac 10.5: I haven't been able to locate a
build of graphviz that both can be installed, and contains a visibible
path to agraph.h. The latest version has no visible path and the .app
content is completely different; most versions on-line (.dmg or Fink)
are earlier than 2.0 (1.10 or 1.13) and doesn't seem compatible with
pygraphviz; I can't make MacPorts work at all ('port is not a valid
command') and DarwinPort seems to have documented inconsistencies. . .

I've tried with half a dozen installs of Python, SVN or easy_install,
and I don't know what more to try.

Aric Hagberg

unread,
Feb 18, 2009, 12:21:06 AM2/18/09
to pygraphvi...@googlegroups.com
On Tue, Feb 17, 2009 at 8:52 PM, Bertil <berti...@gmail.com> wrote:
>
> I've tried all day and most of the night, and I can't find a way to
> install pygraphviz with Mac 10.5: I haven't been able to locate a
> build of graphviz that both can be installed, and contains a visibible
> path to agraph.h. The latest version has no visible path and the .app
> content is completely different; most versions on-line (.dmg or Fink)
> are earlier than 2.0 (1.10 or 1.13) and doesn't seem compatible with
> pygraphviz; I can't make MacPorts work at all ('port is not a valid
> command') and DarwinPort seems to have documented inconsistencies. . .

I'm sorry you are having so much trouble. Here is some info that
I think will help you get it working.

Starting with pygraphviz-0.99.1 we switched from using the Graphviz
libagraph to libcgraph. Apparently libagraph is being phased out.
So get a recent version of PyGraphviz that uses libcgraph.
If you can, grab the latest source from
http://networkx.lanl.gov/download/pygraphviz/
or from the subversion repository. There have been a few small
fixes since the 0.99.1 release so use the dev tarball if you want those.

I have tested the following two OSX graphviz packages and they both
work with the latest development version of PyGraphviz

1) The OSX dmg from http://graphviz.org/Download_macos.php
Unfortunately libcgraph seems to be missing in the "stable" version
at that URL.
So get the latest version (which today is):
http://graphviz.org/pub/graphviz/development/macos/leopard/graphviz-2.21.20090217.0545.pkg


2) The fink unstable repository with graphviz-2.18-2
http://pdb.finkproject.org/pdb/package.php/graphviz
Make sure you install the -dev and -shlibs packages too:
$ fink list graphviz
Information about 7751 packages read in 2 seconds.
i graphviz 2.18-2 Graph visualization software
i graphviz-dev 2.18-2 development files for graphviz
i graphviz-shlibs 2.18-2 Graph visualization software


After you get those installed unpack the pygraphviz source tar file
and run "python setup.py install".
In both cases the PyGraphviz setup.py autodetected the correct library
and include file paths for me.


Aric

Bertil Hatt

unread,
Feb 18, 2009, 12:36:05 AM2/18/09
to pygraphvi...@googlegroups.com
Sorry, but I've tried with those to — and they don't seem to do the
trick: GraphViz install, but when I want to install PyGraphViz, the
log is much too long (more then 60 pages) and fails:

bertil-laptop:pygraphviz-1.0.dev1155 bertil$ python setup.py install
library_path=/opt/local/lib/graphviz
include_path=/opt/local/include/graphviz
running install
running build
running build_py
creating build
creating build/lib.macosx-10.3-i386-2.5
creating build/lib.macosx-10.3-i386-2.5/pygraphviz
copying pygraphviz/__init__.py -> build/lib.macosx-10.3-i386-2.5/pygraphviz
copying pygraphviz/agraph.py -> build/lib.macosx-10.3-i386-2.5/pygraphviz
copying pygraphviz/graphviz.py -> build/lib.macosx-10.3-i386-2.5/pygraphviz
copying pygraphviz/release.py -> build/lib.macosx-10.3-i386-2.5/pygraphviz

[. . .]

pygraphviz/graphviz_wrap.c:2495:20: error: cgraph.h: No such file or directory
pygraphviz/graphviz_wrap.c:2495:20: error: cgraph.h: No such file or directory
pygraphviz/graphviz_wrap.c:2789: error: syntax error before '*' token
pygraphviz/graphviz_wrap.c: In function 'agattrname':
pygraphviz/graphviz_wrap.c:2790: error: 'atsym' undeclared (first use
in this function)
pygraphviz/graphviz_wrap.c:2790: error: (Each undeclared identifier is
reported only once

[. . .]

pygraphviz/graphviz_wrap.c: In function 'Swig_var_Agstrictundirected_get':
pygraphviz/graphviz_wrap.c:4388: error: 'Agstrictundirected'
undeclared (first use in this function)
lipo: can't figure out the architecture type of:
/var/folders/C3/C38Q0YCTFJikfaDBR+hUWk+++TI/-Tmp-//ccO6189i.out
error: command 'gcc' failed with exit status 1

My main problem is that I don't understand most of it, so I have no
idea what could be a possible next step.

Aric Hagberg

unread,
Feb 18, 2009, 12:49:58 AM2/18/09
to pygraphvi...@googlegroups.com
On Tue, Feb 17, 2009 at 10:36 PM, Bertil Hatt <berti...@gmail.com> wrote:
>
> Sorry, but I've tried with those to — and they don't seem to do the
> trick: GraphViz install, but when I want to install PyGraphViz, the
> log is much too long (more then 60 pages) and fails:
>
> bertil-laptop:pygraphviz-1.0.dev1155 bertil$ python setup.py install
> library_path=/opt/local/lib/graphviz
> include_path=/opt/local/include/graphviz

Is this the Darwin ports install location?

For the packages I mentioned,
fink puts the files in
/sw/lib
/sw/include/graphviz

and the dmg puts files in
/usr/local/lib
/usr/local/include/graphviz

You might try to removing the (potentially broken?) version in
/opt or editing the search path by hand (see setup.py).

Aric

Bertil Hatt

unread,
Feb 18, 2009, 1:05:22 AM2/18/09
to pygraphvi...@googlegroups.com
I just noticed the difference between /usr/ and /opt/ — I guess I've
been plowing too late on that. . .

Thank you so much for the heads-up.

Turadg

unread,
Mar 23, 2009, 1:46:28 PM3/23/09
to pygraphviz-discuss


On Feb 18, 1:21 am, Aric Hagberg <aric.hagb...@gmail.com> wrote:
> Starting with pygraphviz-0.99.1 we switched from using the Graphviz
> libagraph to libcgraph.   Apparently libagraph is being phased out.
> So get a recent version of PyGraphviz that uses libcgraph.
> If you can, grab the latest source fromhttp://networkx.lanl.gov/download/pygraphviz/
> or from the subversion repository.  There have been a few small
> fixes since the 0.99.1 release so use the dev tarball if you want those.
>
> I have tested the following two OSX graphviz packages and they both
> work with the latest development version of PyGraphviz
>
> 1) The OSX dmg fromhttp://graphviz.org/Download_macos.php
>    Unfortunately libcgraph seems to be missing in the "stable" version
>    at that URL.
>    So get the latest version (which today is):
>    http://graphviz.org/pub/graphviz/development/macos/leopard/graphviz-2...
[...]
>
> After you get those installed unpack the pygraphviz source tar file
> and run "python setup.py install".
> In both cases the PyGraphviz setup.py autodetected the correct library
> and include file paths for me.


This almost worked for me. Here is my experience.

- downloaded and installed the nightly DMG build of graphviz from the
URL you gave,
http://graphviz.org/pub/graphviz/development/macos/leopard/

- tried "sudo easy_install pygraphviz" but it couldn't find the paths
to the libraries. This appears due to in part to the omission of
"dotneato-config' from the DMG distribution.

- downloaded the dev tarball of pygraphviz and uncommented the second
set of path binding lines in setup.py. (Incidentally, added "Mac OS X
(DMG distribution)" to the comment on them could help)

- ran `python setup.py install` and it built okay

But now my problem is that when I open Python and enter "import
pygraphviz" I get this traceback:
>>> import pygraphviz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pygraphviz/__init__.py", line 36, in <module>
from agraph import AGraph, Node, Edge, Attribute, ItemAttribute
File "pygraphviz/agraph.py", line 18, in <module>
import graphviz as gv
File "pygraphviz/graphviz.py", line 7, in <module>
import _graphviz
ImportError: No module named _graphviz


Any further help?

fwiw, once I get this working I'd like to provide a Mac egg binary
distribution for Pypi. Aric, would I just e-mail that to you?


-Turadg

Turadg

unread,
Mar 23, 2009, 3:26:55 PM3/23/09
to pygraphviz-discuss
Update: it's all working.

Diederik figured out that the problem was that I had run `python` from
within the pygraphviz source directory. When I run it anywhere else
the module loads fine.

I'd still like to contribute the Mac .egg. I'm presuming that that
will allow Mac users to "sudo easy_install pygraphviz" and if they
have installed the latest DMG of Graphviz, they should be all set.
Correct?

thanks,
Turadg


On Mar 23, 1:46 pm, Turadg <tur...@gmail.com> wrote:
> On Feb 18, 1:21 am, Aric Hagberg <aric.hagb...@gmail.com> wrote:
>
>
>
>
>
> > Starting with pygraphviz-0.99.1 we switched from using the Graphviz
> > libagraph to libcgraph.   Apparently libagraph is being phased out.
> > So get a recent version of PyGraphviz that uses libcgraph.
> > If you can, grab the latest source fromhttp://networkx.lanl.gov/download/pygraphviz/
> > or from the subversion repository.  There have been a few small
> > fixes since the 0.99.1 release so use the dev tarball if you want those.
>
> > I have tested the following two OSX graphviz packages and they both
> > work with the latest development version of PyGraphviz
>
> > 1) The OSX dmg fromhttp://graphviz.org/Download_macos.php
> >    Unfortunately libcgraph seems to be missing in the "stable" version
> >    at that URL.
> >    So get the latest version (which today is):
> >    http://graphviz.org/pub/graphviz/development/macos/leopard/graphviz-2...
> [...]
>
> > After you get those installed unpack the pygraphviz source tar file
> > and run "python setup.py install".
> > In both cases the PyGraphviz setup.py autodetected the correct library
> > and include file paths for me.
>
> This almost worked for me.  Here is my experience.
>
> - downloaded and installed the nightly DMG build of graphviz from the
> URL you gave,http://graphviz.org/pub/graphviz/development/macos/leopard/

Aric Hagberg

unread,
Mar 23, 2009, 5:09:53 PM3/23/09
to pygraphvi...@googlegroups.com
On Mon, Mar 23, 2009 at 1:26 PM, Turadg <tur...@gmail.com> wrote:
>
> Update: it's all working.
>
> Diederik figured out that the problem was that I had run `python` from
> within the pygraphviz source directory.  When I run it anywhere else
> the module loads fine.
>
> I'd still like to contribute the Mac .egg.  I'm presuming that that
> will allow Mac users to "sudo easy_install pygraphviz" and if they
> have installed the latest DMG of Graphviz, they should be all set.
> Correct?
>

That should be a FAQ - I'll add it.

I'm not completely sure how the eggs work for C extension code.
It must have to check for matching compiler Graphviz and Python setup?

Aric

Turadg

unread,
Mar 24, 2009, 3:47:49 PM3/24/09
to pygraphviz-discuss
On Mar 23, 5:09 pm, Aric Hagberg <aric.hagb...@gmail.com> wrote:
> > I'd still like to contribute the Mac .egg.  I'm presuming that that
> > will allow Mac users to "sudo easy_install pygraphviz" and if they
> > have installed the latest DMG of Graphviz, they should be all set.
> > Correct?
>
> I'm not completely sure how the eggs work for C extension code.
> It must have to check for matching compiler Graphviz and Python setup?

That's part of its spec, I believe. I built it with setup_egg.py and
the filename is,
pygraphviz-1.0-py2.5-macosx-10.3-i386.egg

It will only get easy_install-ed for Intel Macs >=10.3 with Python
2.5. They'll still need the latest Graphviz with libcgraph.so, but at
least they won't need a compiler in order to use it.

I'll send the egg to you by e-mail.

-Turadg
Reply all
Reply to author
Forward
0 new messages