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
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
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
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
>
> 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
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
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
Installation looks good. Can you send us the output of:
>>> import imp
>>> imp.find_module('pygraphviz')
Chris
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
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
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!?
$ 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.
> email to pygraphviz-discuss+unsub...@googlegroups.com.
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