Hello!
I've got graphviz installed with python and python27 bindings. However, when I do:
graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.pdf", layout="fdp")
I get the following error:
graph G { graph [outputorder=edgesfirst, mode=major, overlap=true, ratio=fill, size="5.905512,5.905512", start=3019255687130444316]; node [label="\N", shape=circle, width="0.105", height="0.105", style=filled, color="#2e3436", fillcolor="#a40000"]; edge [arrowsize="0.3", color="#2e3436", penwidth="1.0"]; graph [bb="0,0,425,425"]; 0 [label=0, width="0.47", height="0.47", pos="330,101"]; 1 [label=1, width="0.47", height="0.47", pos="93,324"]; 0 -- 1 [pos="318,113 277,152 147,274 106,312"]; } Error: renderer for pdf is unavailable Out[8]: <PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x5ff3f90, at 0x6001290>
At the same time, if I save the above dot expression as test1.dot and run the following command from the command line:
$ dot -Tpng test1.dot -o graph1.png
I get a beautiful graph1.png.
Graphviz is installed in a non-standard location as I don't have admin rights. However, the graphviz folder is in LD_LIBRARY_PATH and gv.py is in PYTHONPATH. Would very much appreciate your advice on what else graph-tool might need to find the libraries and/or how to test it better.
Many thanks, Mikhail
PS. Sorry for an inconsistent example! In fact, both of these work:
$ dot -Tpng test1.dot -o graph1.png $ dot -Tpdf test1.dot -o graph1.pdf
while none of those do:
graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.png", layout="fdp") graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.pdf", layout="fdp")
so it's not format-dependent.
Many thanks, Mikhail
On Sun, Apr 8, 2012 at 5:52 PM, Mikhail Spivakov spivakov@ebi.ac.uk wrote:
Hello!
I've got graphviz installed with python and python27 bindings. However, when I do:
graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.pdf", layout="fdp")
I get the following error:
graph G { graph [outputorder=edgesfirst, mode=major, overlap=true, ratio=fill, size="5.905512,5.905512", start=3019255687130444316]; node [label="\N", shape=circle, width="0.105", height="0.105", style=filled, color="#2e3436", fillcolor="#a40000"]; edge [arrowsize="0.3", color="#2e3436", penwidth="1.0"]; graph [bb="0,0,425,425"]; 0 [label=0, width="0.47", height="0.47", pos="330,101"]; 1 [label=1, width="0.47", height="0.47", pos="93,324"]; 0 -- 1 [pos="318,113 277,152 147,274 106,312"]; } Error: renderer for pdf is unavailable Out[8]: <PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x5ff3f90, at 0x6001290>
At the same time, if I save the above dot expression as test1.dot and run the following command from the command line:
$ dot -Tpng test1.dot -o graph1.png
I get a beautiful graph1.png.
Graphviz is installed in a non-standard location as I don't have admin rights. However, the graphviz folder is in LD_LIBRARY_PATH and gv.py is in PYTHONPATH. Would very much appreciate your advice on what else graph-tool might need to find the libraries and/or how to test it better.
Many thanks, Mikhail
Hi,
On 04/08/2012 03:57 PM, Mikhail Spivakov wrote:
PS. Sorry for an inconsistent example! In fact, both of these work:
$ dot -Tpng test1.dot -o graph1.png $ dot -Tpdf test1.dot -o graph1.pdf
while none of those do:
graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.png", layout="fdp") graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.pdf", layout="fdp")
so it's not format-dependent.
I cannot reproduce this... Are you sure your command line examples use the same graphviz installation which is available to graph-tool?
graph-tool just passes the format choice down to the graphviz library. If it complains it does not understand the format, it means it was not enabled during compilation.
Check again your LD_LIBRARY_PATH and PYTHON_PATH to make sure they are pointing to the correct places.
Cheers, Tiago
-- Tiago de Paula Peixoto tiago@skewed.de
I've now managed to resolve this. Was due to multiple libgvc versions present in the system. My solution, which unfortunately isn't elegant, was to hardcode the library name into draw/__init__.py instead of using ctypes.util.find_library. The problem with find_library is that it doesn't consult LD_LIBRARY_PATH, making the search algorithm rather inflexible.
libgv = ctypes.CDLL("libgvc.so.6.0.0") # libname = ctypes.util.find_library("gvc") # if libname is None: # raise OSError() # libgv = ctypes.CDLL(libname)
Best, Mikhail
On Sun, Apr 8, 2012 at 2:57 PM, Mikhail Spivakov spivakov@ebi.ac.uk wrote:
PS. Sorry for an inconsistent example! In fact, both of these work:
$ dot -Tpng test1.dot -o graph1.png $ dot -Tpdf test1.dot -o graph1.pdf
while none of those do:
graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.png", layout="fdp") graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.pdf", layout="fdp")
so it's not format-dependent.
Many thanks, Mikhail
On Sun, Apr 8, 2012 at 5:52 PM, Mikhail Spivakov spivakov@ebi.ac.uk wrote:
Hello!
I've got graphviz installed with python and python27 bindings. However, when I do:
graph_draw(ug, vprops={"label": ug.vertex_index}, output="two-nodes.pdf", layout="fdp")
I get the following error:
graph G { graph [outputorder=edgesfirst, mode=major, overlap=true, ratio=fill, size="5.905512,5.905512", start=3019255687130444316]; node [label="\N", shape=circle, width="0.105", height="0.105", style=filled, color="#2e3436", fillcolor="#a40000"]; edge [arrowsize="0.3", color="#2e3436", penwidth="1.0"]; graph [bb="0,0,425,425"]; 0 [label=0, width="0.47", height="0.47", pos="330,101"]; 1 [label=1, width="0.47", height="0.47", pos="93,324"]; 0 -- 1 [pos="318,113 277,152 147,274 106,312"]; } Error: renderer for pdf is unavailable Out[8]: <PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x5ff3f90, at 0x6001290>
At the same time, if I save the above dot expression as test1.dot and run the following command from the command line:
$ dot -Tpng test1.dot -o graph1.png
I get a beautiful graph1.png.
Graphviz is installed in a non-standard location as I don't have admin rights. However, the graphviz folder is in LD_LIBRARY_PATH and gv.py is in PYTHONPATH. Would very much appreciate your advice on what else graph-tool might need to find the libraries and/or how to test it better.
Many thanks, Mikhail
On 04/08/2012 11:30 PM, Mikhail Spivakov wrote:
I've now managed to resolve this. Was due to multiple libgvc versions present in the system. My solution, which unfortunately isn't elegant, was to hardcode the library name into draw/__init__.py instead of using ctypes.util.find_library. The problem with find_library is that it doesn't consult LD_LIBRARY_PATH, making the search algorithm rather inflexible.
libgv = ctypes.CDLL("libgvc.so.6.0.0") # libname = ctypes.util.find_library("gvc") # if libname is None: # raise OSError() # libgv = ctypes.CDLL(libname)
Best, Mikhail
There should be a way to fix this in a more robust fashion... Could you perhaps open a ticket, so that I don't forget?
Cheers, Tiago
It's been 4 years since the original post, but I ran into this problem today. I'm in ubuntu 14.04. Originally I installed graphviz through the ubuntu repos with `apt-get` and `graphviz_draw` worked fine with pdf's. I removed my installation of graphviz and built from source and I get the same error mentioned above. The fix works, although its in 'graphviz_draw.py' not '__init__.py'.
-- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.