pygraphviz can't find Neato

6,280 views
Skip to first unread message

Diederik

unread,
Mar 15, 2009, 2:49:27 PM3/15/09
to pygraphviz-discuss
Hi!

i have been trying to get pygraphviz to work and I am going
nowhere .....:( I installed graphviz & pygraphviz, they both import
correctly (python 2.5 / OSX 10.5) but when i run the pygraphviz.test()
then it throws an error saying:

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/layout_draw.txt", line 78, in
layout_draw.txt
Failed example:
A.layout()
Exception raised:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest layout_draw.txt[29]>", line 1, in <module>
A.layout()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1196, in layout
data=self._run_prog(prog,' '.join([args,"-T",fmt]))
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1139, in _run_prog
runprog=self._get_prog(prog)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1125, in _get_prog
raise ValueError("Program %s not found in path."%prog)
ValueError: Program neato not found in path.

i have added some symlinks to help python find the neato but it
doesn't work. if I just enter neato then it launches a program (i
think that graphviz has symlinked neato to dot).
Any suggestions to get this working?

thanks a lot!
best,
Diederik

Aric Hagberg

unread,
Mar 15, 2009, 3:03:45 PM3/15/09
to pygraphvi...@googlegroups.com

It sounds like either neato isn't in your path or it isn't working for
some reason.
In a terminal window can you try the following?

$ which neato
/sw/bin/neato
$ neato -V
neato - Graphviz version 2.18 (Tue Feb 24 19:12:49 UTC 2009)
$ echo 'graph {}' |neato
graph {
node [label="\N"];
graph [bb="0,0,2,2"];
}

Your paths will probably be different since I am using the fink
package for Graphviz here.

Aric

Diederik

unread,
Mar 16, 2009, 11:36:23 AM3/16/09
to pygraphviz-discuss
Hi Aric,

the result of which neata is:
/usr/local/bin/neato

neato -V:
neato - graphviz version 2.22.2 (20090313.1817)

and the result of echo 'graph {}' |neato is:
graph {
node [label="\N"];
graph [bb="0,0,0,0"];
}


I hope this helps, (i don't use finkle or macports, i installed
graphviz first as a dmg and then replaced it with a self made
compilation).
Best,
Diederik
On Mar 15, 3:03 pm, Aric Hagberg <aric.hagb...@gmail.com> wrote:

Diederik

unread,
Mar 16, 2009, 3:43:20 PM3/16/09
to pygraphviz-discuss
A small additional note:
I cannot do 'import graphviz' or 'import _graphviz' but 'import gv'
does work

Aric Hagberg

unread,
Mar 16, 2009, 8:23:37 PM3/16/09
to pygraphvi...@googlegroups.com
On Mon, Mar 16, 2009 at 9:36 AM, Diederik <dvan...@gmail.com> wrote:
>
> Hi Aric,
>
> the result of which neata is:
> /usr/local/bin/neato
>
> neato -V:
> neato - graphviz version 2.22.2 (20090313.1817)
>
> and the result of echo  'graph {}' |neato is:
> graph {
>        node [label="\N"];
>        graph [bb="0,0,0,0"];
> }
>

Try running this (this is what pygraphviz uses to find neato)

import os
import glob
paths = os.environ["PATH"]
print paths
for path in paths.split(os.pathsep):
match=glob.glob(os.path.join(path,'neato'))
if match:
print match[0]

Aric

Diederik

unread,
Mar 16, 2009, 10:53:57 PM3/16/09
to pygraphviz-discuss
the result is: '/usr/local/bin/neato'
which is exactly the same as 'which neato'.
but pygraphviz also fails the pygraphviz.tests()




On Mar 16, 8:23 pm, Aric Hagberg <aric.hagb...@gmail.com> wrote:

Aric Hagberg

unread,
Mar 18, 2009, 12:03:54 AM3/18/09
to pygraphvi...@googlegroups.com
On Mon, Mar 16, 2009 at 8:53 PM, Diederik <dvan...@gmail.com> wrote:
>
> the result is: '/usr/local/bin/neato'
> which is exactly the same as 'which neato'.
> but pygraphviz also fails the pygraphviz.tests()
>

I'm stumped on this one. It seems like your graphviz install is fine.
But the tests are failing? Can you try

>>> import pygraphviz
>>> a=pygraphviz.AGraph()
>>> a._get_prog('neato')
'/usr/local/bin/neato

And maybe also send the full output of

>>> import pygraphviz
>>> pygraphviz.__version__
>>> pygraphviz.test()

This is definitely fixable! We'll figure it out.

Aric

Diederik

unread,
Mar 18, 2009, 1:41:49 AM3/18/09
to pygraphviz-discuss
Hi Aric,

Here is the requested output, maybe the origin of the problem is not
in graphviz... but i wouldn't bet on it either.
best,
diederik


Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygraphviz
>>> a=pygraphviz.AGraph()
>>> a._get_prog('neato')
'/usr/local/bin/neato'
>>> pygraphviz.__version__
'1.0'
>>> pygraphviz.test()
F..
======================================================================
FAIL: Doctest: graph.txt
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 2128, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for graph.txt
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/tests/graph.txt", line 0

----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 347, in graph.txt
Failed example:
A.edges()
Expected:
[('1', '2')]
Got:
[('1', '2'), ('3', '3')]
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 379, in graph.txt
Failed example:
eone=A.get_edge(3,3,'foo')
Exception raised:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest graph.txt[162]>", line 1, in <module>
eone=A.get_edge(3,3,'foo')
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 415, in get_edge
return Edge(self,u,v,key)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1477, in __new__
raise KeyError("Edge %s-%s not in graph."%(source,target))
KeyError: 'Edge 3-3 not in graph.'
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 381, in graph.txt
Failed example:
edge=Edge(A,3,3,'foo')
Exception raised:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest graph.txt[164]>", line 1, in <module>
edge=Edge(A,3,3,'foo')
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1477, in __new__
raise KeyError("Edge %s-%s not in graph."%(source,target))
KeyError: 'Edge 3-3 not in graph.'
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 384, in graph.txt
Failed example:
edge
Expected:
('3', '3')
Got:
('1', '2')
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 386, in graph.txt
Failed example:
eone
Expected:
('3', '3')
Got:
('1', '2')
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 388, in graph.txt
Failed example:
edge.name
Expected:
'foo'
Got nothing


----------------------------------------------------------------------
Ran 3 tests in 1.914s

FAILED (failures=1)




On Mar 18, 12:03 am, Aric Hagberg <aric.hagb...@gmail.com> wrote:

Aric Hagberg

unread,
Mar 18, 2009, 10:25:46 AM3/18/09
to pygraphvi...@googlegroups.com
On Tue, Mar 17, 2009 at 11:41 PM, Diederik <dvan...@gmail.com> wrote:
>
> Hi Aric,
>
> Here is the requested output, maybe the origin of the problem is not
> in graphviz... but i wouldn't bet on it either.
> best,

That is a different error than before. I can reproduce your result with
graphviz-2.22.2.pkg from
http://graphviz.org/Download_macos.php
(with Python2.5 and Python2.6 and the svn version of PyGraphviz.)

It looks to me like perhaps a bug in Graphviz or maybe some change in
the libcgraph API that I am not aware of.

PyGraphviz does work with graphviz-2.20.3
(other than known Graphviz bugs related to subgraphs and others?, e.g.
http://graphviz.org/bugs/b1526.html)

I'll see if I can figure out the exact problem.

Aric

Aric Hagberg

unread,
Mar 18, 2009, 10:55:40 AM3/18/09
to pygraphvi...@googlegroups.com
On Wed, Mar 18, 2009 at 8:25 AM, Aric Hagberg <aric.h...@gmail.com> wrote:

>
> I'll see if I can figure out the exact problem.

It's definitely a new Graphviz change/bug.
Strict graphs can't have self-loops but they are being
allowed internally in Graphviz:

In [1]: from pygraphviz import *

In [2]: A=AGraph()

In [3]: A
Out[3]:
strict graph {
}

In [4]: A.add_edge(1,1)

In [5]: A
Out[5]:
strict graph {
1 -- 1;
}

Aric

Diederik

unread,
Mar 18, 2009, 11:33:08 AM3/18/09
to pygraphviz-discuss
hi aric
i should have been more clear at the start of the bug: so it started
with pygrahpviz not finding neato, after some experimenting i reported
it here, later i tried the .test() function and that gave the output i
posted yesterday. my guess, is that neato is not really the problem,
that it is triggered sooner (as you probably detected the the real
cause). indeed, i use graphviz 2.22.2 (this time installed with
macports, but i also tried the pkg version)
thanks for all your help and two wonderful packages!!!!
best,
Diederik

On Mar 18, 10:55 am, Aric Hagberg <aric.hagb...@gmail.com> wrote:

Aric Hagberg

unread,
Mar 18, 2009, 9:50:48 PM3/18/09
to pygraphvi...@googlegroups.com
On Wed, Mar 18, 2009 at 9:33 AM, Diederik <dvan...@gmail.com> wrote:
>
> hi aric
> i should have been more clear at the start of the bug: so it started
> with pygrahpviz not finding neato, after some experimenting i reported
> it here, later i tried the .test() function and that gave the output i
> posted yesterday. my guess, is that neato is not really the problem,
> that it is triggered sooner (as you probably detected the the real
> cause). indeed, i use graphviz 2.22.2 (this time installed with

I just checked in a fix for this (now passes all tests with 2.22.2)
https://networkx.lanl.gov/trac/changeset/1183

The problem was that the semantics of a graphviz "strict" graph
changed to allow self loops. The Graphviz team was very helpful in
figuring this out.

Aric

Diederik

unread,
Mar 19, 2009, 9:44:38 AM3/19/09
to pygraphviz-discuss
Hi Aric,

Great! I have checked out the most recent version and compiled it,
however, it now gives the following error:

Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 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

I have checked in the pygraphviz folder, and there is a file called
_graphviz.so, so i am not sure why it cannot find that module.
do you have any suggestions?
best,
Diederik

On Mar 18, 9:50 pm, Aric Hagberg <aric.hagb...@gmail.com> wrote:
> On Wed, Mar 18, 2009 at 9:33 AM, Diederik <dvanli...@gmail.com> wrote:
>
> > hi aric
> > i should have been more clear at the start of the bug: so it started
> > with pygrahpviz not finding neato, after some experimenting i reported
> > it here, later i tried the .test() function and that gave the output i
> > posted yesterday. my guess, is that neato is not really the problem,
> > that it is triggered sooner (as you probably detected the the real
> > cause). indeed, i use graphviz 2.22.2 (this time installed with
>
> I just checked in a fix for this (now passes all tests with 2.22.2)https://networkx.lanl.gov/trac/changeset/1183

Diederik

unread,
Mar 19, 2009, 10:20:09 AM3/19/09
to pygraphviz-discuss
okay, sorry for bothering you: the _graphviz.so issue can be resolved
by starting python from the pygraphviz directory, then it is able to
find the _graphviz.so module.
however, when i run the tests, they still fail although i do think
with slightly different errors than before. (I first removed all the
old pygraph versions before installing the new version). this is the
output:
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygraphviz
>>> pygraphviz.test()
F..
======================================================================
FAIL: Doctest: graph.txt
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 2128, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for graph.txt
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/tests/graph.txt", line 0

----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 347, in graph.txt
Failed example:
A.edges()
Expected:
[('1', '2')]
Got:
[('1', '2'), ('3', '3')]
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 379, in graph.txt
Failed example:
eone=A.get_edge(3,3,'foo')
Exception raised:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest graph.txt[162]>", line 1, in <module>
eone=A.get_edge(3,3,'foo')
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 415, in get_edge
return Edge(self,u,v,key)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1477, in __new__
raise KeyError("Edge %s-%s not in graph."%(source,target))
KeyError: 'Edge 3-3 not in graph.'
----------------------------------------------------------------------
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/graph.txt", line 381, in graph.txt
Failed example:
edge=Edge(A,3,3,'foo')
Exception raised:
Traceback (most recent call last):
Ran 3 tests in 0.441s

FAILED (failures=1)
>>>
any tips?
best,
Diederik

Aric Hagberg

unread,
Mar 19, 2009, 10:24:03 AM3/19/09
to pygraphvi...@googlegroups.com
On Thu, Mar 19, 2009 at 7:44 AM, Diederik <dvan...@gmail.com> wrote:
>
> Hi Aric,
>
> Great! I have checked out the most recent version and compiled it,
> however, it now gives the following error:
>
> Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27)
> [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 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
>
> I have checked in the pygraphviz folder, and there is a file called
> _graphviz.so, so i am not sure why it cannot find that module.
> do you have any suggestions?

You probably are trying to run pygraphviz from the source directory.
If that is the case, install first (into some directory in your python path)
and then give it a try. Use
$ python setup.py install
with optional --prefix or --home

Aric

Diederik

unread,
Mar 20, 2009, 7:23:15 PM3/20/09
to pygraphviz-discuss
Hi Aric,

I have double checked, i am not running python from the pygraphviz
source directory, but the tests still fail....
i am running out of options, i am afraid....
best,
Diederik

On Mar 19, 10:24 am, Aric Hagberg <aric.hagb...@gmail.com> wrote:

Diederik

unread,
Mar 20, 2009, 7:26:45 PM3/20/09
to pygraphviz-discuss
this is the output of the compile process:

localhost:pygraphviz diederik$ python setup.py install
Trying pkg-config
library_path=/usr/local/lib
include_path=/usr/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
creating build/lib.macosx-10.3-i386-2.5/pygraphviz/tests
copying pygraphviz/tests/__init__.py -> build/lib.macosx-10.3-i386-2.5/
pygraphviz/tests
copying pygraphviz/tests/test.py -> build/lib.macosx-10.3-i386-2.5/
pygraphviz/tests
copying pygraphviz/tests/attributes.txt -> build/lib.macosx-10.3-
i386-2.5/pygraphviz/tests
copying pygraphviz/tests/graph.txt -> build/lib.macosx-10.3-i386-2.5/
pygraphviz/tests
copying pygraphviz/tests/layout_draw.txt -> build/lib.macosx-10.3-
i386-2.5/pygraphviz/tests
copying pygraphviz/tests/subgraph.txt -> build/lib.macosx-10.3-
i386-2.5/pygraphviz/tests
running build_ext
building 'pygraphviz._graphviz' extension
creating build/temp.macosx-10.3-i386-2.5
creating build/temp.macosx-10.3-i386-2.5/pygraphviz
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -
fno-common -dynamic -DNDEBUG -g -O3 -I/usr/local/include/graphviz -I/
Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c
pygraphviz/graphviz_wrap.c -o build/temp.macosx-10.3-i386-2.5/
pygraphviz/graphviz_wrap.o
gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -
bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386-2.5/
pygraphviz/graphviz_wrap.o -L/usr/local/lib -L/usr/local/lib -lcgraph -
lcdt -o build/lib.macosx-10.3-i386-2.5/pygraphviz/_graphviz.so
running install_lib
copying build/lib.macosx-10.3-i386-2.5/pygraphviz/_graphviz.so -> /
Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-
packages/pygraphviz
running install_data
running install_egg_info
Removing /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz-1.0.dev1183-py2.5.egg-info
Writing /Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz-1.0.dev1183-py2.5.egg-info

Christopher Ellison

unread,
Mar 21, 2009, 4:01:50 PM3/21/09
to pygraphvi...@googlegroups.com
Diederik wrote the following on 03/20/2009 04:26 PM:
> this is the output of the compile process:
>
[snip]

Installation looks good. Can you send us the output of:

>>> import imp
>>> imp.find_module('pygraphviz')

Chris

Aric Hagberg

unread,
Mar 21, 2009, 6:24:37 PM3/21/09
to pygraphvi...@googlegroups.com

Actually it is more complicated than this and I don't think I have
fixed the problem.
It looks like there are some other issues (other tests fail).
I'm going to have to read the Graphviz code or talk to the graphviz developers
to figure this out.

For the time being I'd suggest using an older version of graphviz.
Version 2.18 works for me.

Aric

Diederik

unread,
Mar 22, 2009, 1:57:17 AM3/22/09
to pygraphviz-discuss
Hi Aric, Chris,

I (finally) got pygraphviz to work on OSX 10.5.
I manually compiled Graphviz 2.18 (downloading all the dependencies,
etc.)
then suddenly pygraphviz passed all the tests, but when i ran the my
own piece of code it still gave the cannot find Neato error.

the weird thing is the following: if I enter
import os
p = os.environ["PATH"]
then p has as value:
/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/local/
bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/
sbin:/usr/local/bin:/usr/X11/bin

basically my complete path, however, the exact same call in the
function _which (sentence 1354) in agraph.py has as result:
/usr/bin:/bin:/usr/sbin:/sbin

Pygraphviz only searches for neato in those 4 directories and
concludes it cannot find it, which is true.
i added a symlink to neato in the /usr/bin directory and that solved
the problem.

The only reason i can think of that there is a difference between
these two calls is that the first one is made directly in the python
prompt and that the second one is made in my pydev / eclipse
environment.

but i am glad it works now! thanks for the help!
best,
Diederik

On Mar 21, 6:24 pm, Aric Hagberg <aric.hagb...@gmail.com> wrote:
> On Wed, Mar 18, 2009 at 7:50 PM, Aric Hagberg <aric.hagb...@gmail.com> wrote:

Christopher Ellison

unread,
Mar 22, 2009, 2:44:08 AM3/22/09
to pygraphvi...@googlegroups.com
Diederik wrote the following on 03/21/2009 10:57 PM:
> The only reason i can think of that there is a difference between
> these two calls is that the first one is made directly in the python
> prompt and that the second one is made in my pydev / eclipse
> environment.

Yup. From the command line, you are in some shell...csh, bash, etc.
I'm not sure what eclipse does, but it is definitely not the same as the
shell at the command line. This is also an issue for environmental
variables, so if you need, LD_LIBRARY_PATH or DYLD_LIBRARY_PATH (for
example), then setting it at command line will not help you when you try
to run programs from eclipse.

Chris

Colby Tibbets

unread,
Oct 26, 2014, 11:03:05 AM10/26/14
to pygraphvi...@googlegroups.com
I am having a similar issue. 

Traceback (most recent call last):

  File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/sim_types.py", line 48, in <module>

    simulator.run(A,D,TRIALS,ATTEMPTS,OUTFILENAME)

  File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/simulator.py", line 129, in run

    generator.exportasgraph(base,f='base.svg')

  File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/generator.py", line 35, in exportasgraph

    G.layout(prog='dot')

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/agraph.py", line 1352, in layout

    data = self._run_prog(prog, ' '.join([args, "-T", fmt]))

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/agraph.py", line 1302, in _run_prog

    runprog = r'"%s"' % self._get_prog(prog)

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/agraph.py", line 1289, in _get_prog

    raise ValueError("Program %s not found in path." % prog)

ValueError: Program dot not found in path.

>>> 


The program reaches into the pygraphviz agraph.py file and then cannot call the dot program (part of graphviz) which I do have installed.


This is the code from the agraph.py file 


    def _get_prog(self, prog):

        # private: get path of graphviz program

        progs = ['neato', 'dot', 'twopi', 'circo', 'fdp', 'nop',

                 'wc', 'acyclic', 'gvpr', 'gvcolor', 'ccomps', 'sccmap', 'tred',

                 'sfdp']

        if prog not in progs:

            raise ValueError("Program %s is not one of: %s." %

                            (prog, ', '.join(progs)))

        try:  # user must pick one of the graphviz programs...

            runprog = self._which(prog)

        except:

            raise ValueError("Program %s not found in path." % prog) <——error is here. 

        return runprog


Can someone PLEASE HELP!?

Aric Hagberg

unread,
Oct 26, 2014, 5:54:09 PM10/26/14
to pygraphvi...@googlegroups.com
It's best to start a new thread instead of reviving a very old one.

It looks like your pygraphviz install is not working correctly. Maybe
you are missing the graphviz package? Try the following tests

aric@aric-virtual-machine ~]$ which dot
/usr/bin/dot
[aric@aric-virtual-machine ~]$ python -c "import pygraphviz; pygraphviz.test()"
Running PyGraphiz
tests:....................................................................................
----------------------------------------------------------------------
Ran 84 tests in 0.410s

OK
> --
> You received this message because you are subscribed to the Google Groups
> "pygraphviz-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pygraphviz-disc...@googlegroups.com.
> To post to this group, send email to pygraphvi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/pygraphviz-discuss.
> For more options, visit https://groups.google.com/d/optout.

Colby Tibbets

unread,
Oct 26, 2014, 6:19:44 PM10/26/14
to pygraphvi...@googlegroups.com
Thanks for your help, I ran the tests. Here are the results. 

$ which dot 

/usr/local/bin/dot

$ /usr/bin/dot 

-bash: /usr/bin/dot: No such file or directory


$ python -c "import pygraphviz; pygraphviz.test()"

Running PyGraphiz tests:....................................................................................

----------------------------------------------------------------------

Ran 84 tests in 0.375s

OK

I have an issue when I run the dot.py program on its own. I receive this error, and it may be related. 

Traceback (most recent call last):

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graphviz/dot.py", line 31, in <module>

    from . import lang, files

ValueError: Attempted relative import in non-package. 

Aric Hagberg

unread,
Oct 26, 2014, 8:18:16 PM10/26/14
to pygraphvi...@googlegroups.com
That dot.py program is not from PyGraphviz.
So in that case PyGraphviz is not your problem (tests pass) and I'm
not sure what the issue is.

If you want more help you'll probably have to post a small example
code that isn't working for you and tell us what your python,
graphviz, etc configuration is.

Aric
>> > email to pygraphviz-disc...@googlegroups.com.
>> > To post to this group, send email to pygraphvi...@googlegroups.com.
>> > Visit this group at http://groups.google.com/group/pygraphviz-discuss.
>> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pygraphviz-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pygraphviz-disc...@googlegroups.com.

Colby Tibbets

unread,
Oct 27, 2014, 10:38:50 AM10/27/14
to pygraphvi...@googlegroups.com

Yes, I fixed the issue with the dot.py by reinstalling graphviz via Home Brew. Now the issue I am having the pygraphviz is as follows.

Traceback (most recent call last):
File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/sim_inputsize.py", line 47, in <module>
simulator.run(A,D,TRIALS,ATTEMPTS,OUTFILENAME)
File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/simulator.py", line 129, in run
generator.exportasgraph(base,f='base.svg')
File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/generator.py", line 25, in exportasgraph
import pygraphviz as pgv
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/__init__.py", line 32, in <module>
from . import release
ImportError: cannot import name release

It results from the following code in the

# Copyright (C) 2004-2010 by
# Aric Hagberg <hag...@lanl.gov>
# Dan Schult <dsc...@colgate.edu>
# Manos Renieris, http://www.cs.brown.edu/~er/
# Distributed with BSD license.
# All rights reserved, see LICENSE for details.

from __future__ import absolute_import
from __future__ import print_function
from __future__ import division

# Release data
from . import release

A related issue may be that it appears pygraphviz can’t see graphviz.

Aric Hagberg

unread,
Oct 27, 2014, 10:46:16 AM10/27/14
to pygraphvi...@googlegroups.com
Try running the tests again. And maybe running some of the PyGraphviz examples?

Aric

Colby Tibbets

unread,
Oct 27, 2014, 11:10:45 AM10/27/14
to pygraphvi...@googlegroups.com
Thanks again for the help, the first error is from a pygraphviz example and the second is from the test. 

Traceback (most recent call last):
  File "/Users/colbytibbets/Documents/Tijls_Files/ANASIME/pygraphviz-1.3rc2/examples/attributes.py", line 8, in <module>
    import pygraphviz as pgv
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/__init__.py", line 58, in <module>
    from .agraph import AGraph, Node, Edge, Attribute, ItemAttribute
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/agraph.py", line 26, in <module>
    from . import graphviz as gv
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/graphviz.py", line 28, in <module>
    _graphviz = swig_import_helper()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/graphviz.py", line 24, in swig_import_helper
    _mod = imp.load_module('_graphviz', fp, pathname, description)
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/_graphviz.so, 2): Library not loaded: /usr/local/lib/libcgraph.6.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/_graphviz.so
  Reason: image not found

>>> import pygraphviz; pygraphviz.test()

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygraphviz; pygraphviz.test()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygraphviz/__init__.py", line 32, in <module>
    from . import release
ImportError: cannot import name release

The pygraphviz setup.py works  
>>> 
library_dirs=/usr/local/lib/graphviz
include_dirs=/usr/local/include/graphviz
>>> 

Aric Hagberg

unread,
Oct 27, 2014, 11:34:57 AM10/27/14
to pygraphvi...@googlegroups.com
Something seems wrong with your PyGraphviz install.
Also make sure you aren't running the tests or other code form the
source directory.
Aric

Colby Tibbets

unread,
Oct 27, 2014, 9:38:47 PM10/27/14
to pygraphvi...@googlegroups.com
I’ve realized that there is something wrong with Python being unable to access graphviz when I do the import command. I tried sys.path.append but there are other errors as well. I will attempt to solve this first.

Apurba Paul

unread,
Dec 20, 2014, 2:12:08 AM12/20/14
to pygraphvi...@googlegroups.com, dvan...@gmail.com
get_prog('neato')
Traceback (most recent call last):

  File "<ipython-input-6-3703fcbe7a54>", line 1, in <module>
    a._get_prog('neato')

  File "C:\Python27\lib\site-packages\pygraphviz\agraph.py", line 1282, in _get_prog
    raise ValueError("Program %s not found in path." % prog)

ValueError: Program neato not found in path.


On Monday, March 16, 2009 12:19:27 AM UTC+5:30, Diederik wrote:
Hi!

i have been trying to get pygraphviz to work and I am going
nowhere .....:(  I installed graphviz & pygraphviz, they both import
correctly (python 2.5 / OSX 10.5) but when i run the pygraphviz.test()
then it throws an error saying:

File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/pygraphviz/tests/layout_draw.txt", line 78, in
layout_draw.txt
Failed example:
    A.layout()
Exception raised:
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/doctest.py", line 1228, in __run
        compileflags, 1) in test.globs
      File "<doctest layout_draw.txt[29]>", line 1, in <module>
        A.layout()
      File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1196, in layout
        data=self._run_prog(prog,' '.join([args,"-T",fmt]))
      File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1139, in _run_prog
        runprog=self._get_prog(prog)
      File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/site-packages/pygraphviz/agraph.py", line 1125, in _get_prog
        raise ValueError("Program %s not found in path."%prog)
    ValueError: Program neato not found in path.

i have added some symlinks to help python find the neato but it
doesn't work. if I just enter neato then it launches a program (i
think that graphviz has symlinked neato to dot).
Any suggestions to get this working?

thanks a lot!
best,
Diederik
Reply all
Reply to author
Forward
0 new messages