google colaboratoryでエラーが出たのですがどのように直せばよいか分かりません。
教えていただけるとありがたいです。
Python
1import networkx as nx 2import matplotlib.pyplot as plt 3 4graph = dgl.batch(tiny_sst) 5 6def plot_tree(g): 7 pos = nx.nx_agraph.graphviz_layout(g, prog='dot') 8 nx.draw(g, pos, with_labels=False, node_size=10, 9 node_color=[[.5, .5, .5]], arrowsize=4) 10 plt.show() 11 12plot_tree(graph.to_networkx())
ModuleNotFoundError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/networkx/drawing/nx_agraph.py in pygraphviz_layout(G, prog, root, args) 282 try: --> 283 import pygraphviz 284 except ImportError: ModuleNotFoundError: No module named 'pygraphviz' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) 3 frames /usr/local/lib/python3.6/dist-packages/networkx/drawing/nx_agraph.py in pygraphviz_layout(G, prog, root, args) 284 except ImportError: 285 raise ImportError('requires pygraphviz ', --> 286 'http://pygraphviz.github.io/') 287 if root is not None: 288 args += "-Groot=%s" % root ImportError: ('requires pygraphviz ', 'http://pygraphviz.github.io/')
###試したこと
Python
1!pip install pygraphviz
Collecting pygraphviz Using cached https://files.pythonhosted.org/packages/7e/b1/d6d849ddaf6f11036f9980d433f383d4c13d1ebcfc3cd09bc845bda7e433/pygraphviz-1.5.zip Building wheels for collected packages: pygraphviz Building wheel for pygraphviz (setup.py) ... error ERROR: Failed building wheel for pygraphviz Running setup.py clean for pygraphviz Failed to build pygraphviz Installing collected packages: pygraphviz Running setup.py install for pygraphviz ... error ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-5ugav0b3/pygraphviz/setup.py'"'"'; __file__='"'"'/tmp/pip-install-5ugav0b3/pygraphviz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-0w1x39zb/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
あなたの回答
tips
プレビュー