I just want to draw a simple graph with Python 3 networkx & graphviz:
import networkx as nx
G = nx.complete_graph(3)
nx.draw_graphviz(G)
I'm using ubuntu14.04 and IPython3 and as usual I did pip3 install networkx and running the code gave me:
ImportError: pydot could not be loaded: http://code.google.com/p/pydot/
And I tried installing pydotplus and running the code:
/usr/local/lib/python3.4/dist-packages/networkx/drawing/nx_pydot.py in pydot_layout(G, prog, root, **kwds)
294
295 if isinstance(node,list):
--> 296 node=node[0]
297 pos=node.get_pos()[1:-1] # strip leading and trailing double quotes
298 if pos != None:
IndexError: list index out of range
and pydot2 also:
/usr/local/lib/python3.4/dist-packages/pydot.py in write(self, path, prog, format)
1893 prog = self.prog
1894
-> 1895 dot_fd = file(path, "w+b")
1896 if format == 'raw':
1897 data = self.to_string()
NameError: name 'file' is not defined
I spent quite some time searching and installing other pydots and pygraphviz combinations already but still no luck.
While this may be related: pydot and graphviz error: Couldn't import dot_parser, loading of dot files will not be possible, that doesn't solve the problem in Python 3.