Zettelkasten-Method / zkviz

Zettel Network Visualizer
MIT License
109 stars 19 forks source link

AttributeError: 'Graph' object has no attribute 'node' #23

Closed quesada closed 3 years ago

quesada commented 4 years ago

AttributeError: 'Graph' object has no attribute 'node'. Using it with graphviz works. Any idea why?

log:

source ~/envs/zkviz/bin/activate (zkviz) (base) q@q:~/Downloads$ pip install zkviz Collecting zkviz Downloading https://files.pythonhosted.org/packages/9f/b0/8d3ff9062bff09a2dda5afc8186b90088eeb6872e66bf1011027af410572/zkviz-1.3.0.tar.gz Collecting graphviz (from zkviz) Downloading https://files.pythonhosted.org/packages/f5/74/dbed754c0abd63768d3a7a7b472da35b08ac442cf87d73d5850a6f32391e/graphviz-0.13.2-py2.py3-none-any.whl Collecting plotly (from zkviz) Downloading https://files.pythonhosted.org/packages/06/e1/88762ade699460dc3229c890f9845d16484a40955a590b65052f0958613c/plotly-4.5.0-py2.py3-none-any.whl (7.1MB) 100% |████████████████████████████████| 7.1MB 2.1MB/s Collecting numpy (from zkviz) Downloading https://files.pythonhosted.org/packages/63/0c/0261693cc3ad8e2b66e66dc2d2676a2cc17d3efb1c58a70db73754320e47/numpy-1.18.1-cp37-cp37m-manylinux1_x86_64.whl (20.1MB) 100% |████████████████████████████████| 20.1MB 1.3MB/s Collecting scipy (from zkviz) Downloading https://files.pythonhosted.org/packages/dd/82/c1fe128f3526b128cfd185580ba40d01371c5d299fcf7f77968e22dfcc2e/scipy-1.4.1-cp37-cp37m-manylinux1_x86_64.whl (26.1MB) 100% |████████████████████████████████| 26.1MB 1.0MB/s Collecting networkx (from zkviz) Downloading https://files.pythonhosted.org/packages/41/8f/dd6a8e85946def36e4f2c69c84219af0fa5e832b018c970e92f2ad337e45/networkx-2.4-py3-none-any.whl (1.6MB) 100% |████████████████████████████████| 1.6MB 11.5MB/s Collecting retrying>=1.3.3 (from plotly->zkviz) Collecting six (from plotly->zkviz) Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl Collecting decorator>=4.3.0 (from networkx->zkviz) Using cached https://files.pythonhosted.org/packages/8f/b7/f329cfdc75f3d28d12c65980e4469e2fa373f1953f5df6e370e84ea2e875/decorator-4.4.1-py2.py3-none-any.whl Installing collected packages: graphviz, six, retrying, plotly, numpy, scipy, decorator, networkx, zkviz Running setup.py install for zkviz ... done Successfully installed decorator-4.4.1 graphviz-0.13.2 networkx-2.4 numpy-1.18.1 plotly-4.5.0 retrying-1.3.3 scipy-1.4.1 six-1.14.0 zkviz-1.3.0 You are using pip version 19.0.3, however version 20.0.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. (zkviz) (base) q@q:~/Downloads$ pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB) 100% |████████████████████████████████| 1.4MB 5.5MB/s Installing collected packages: pip Found existing installation: pip 19.0.3 Uninstalling pip-19.0.3: Successfully uninstalled pip-19.0.3 Successfully installed pip-20.0.2 (zkviz) (base) q@q:~/Downloads$ cd (zkviz) (base) q@q:~$ cd Seafile/notes/ AIDD/ leo-editor-master/ notekit/ notess/ sciter-sdk/ txt2020/ zk/
(zkviz) (base) q@q:~$ cd Seafile/notes/zk/s/ data/ include/ lib/ lib2to3/ notes/ PyQt5/ themes/ zettelkasten/ znotes/
(zkviz) (base) q@q:~$ cd Seafile/notes/zk/s/zettelkasten/ (zkviz) (base) q@q:~/Seafile/notes/zk/s/zettelkasten$ ~/envs/zkviz/bin/zkviz Traceback (most recent call last): File "/home/q/envs/zkviz/bin/zkviz", line 11, in load_entry_point('zkviz==1.3.0', 'console_scripts', 'zkviz')() File "/home/q/envs/zkviz/lib/python3.7/site-packages/zkviz/zkviz.py", line 197, in main graph.render(args.output) File "/home/q/envs/zkviz/lib/python3.7/site-packages/zkviz/plotly.py", line 158, in render fig = self.build_plotly_figure() File "/home/q/envs/zkviz/lib/python3.7/site-packages/zkviz/plotly.py", line 98, in build_plotly_figure text = "
".join([node, self.graph.node[node].get("title", "")]) AttributeError: 'Graph' object has no attribute 'node'

achamess commented 4 years ago

I'm also getting this error. If I choose `use-graphviz, it works. So it seems to be an issue with plotly.

Traceback (most recent call last):
  File "/Users/alex/envs/zkviz/bin/zkviz", line 10, in <module>
    sys.exit(main())
  File "/Users/alex/envs/zkviz/lib/python3.7/site-packages/zkviz/zkviz.py", line 197, in main
    graph.render(args.output)
  File "/Users/alex/envs/zkviz/lib/python3.7/site-packages/zkviz/plotly.py", line 158, in render
    fig = self.build_plotly_figure()
  File "/Users/alex/envs/zkviz/lib/python3.7/site-packages/zkviz/plotly.py", line 98, in build_plotly_figure
    text = "<br>".join([node, self.graph.node[node].get("title", "")])
AttributeError: 'Graph' object has no attribute 'node'
oolonek commented 4 years ago

Same here !


Traceback (most recent call last):
  File "/Users/pma/envs/zkviz/bin/zkviz", line 11, in <module>
    load_entry_point('zkviz==1.3.0', 'console_scripts', 'zkviz')()
  File "/Users/pma/envs/zkviz/lib/python3.7/site-packages/zkviz/zkviz.py", line 197, in main
    graph.render(args.output)
  File "/Users/pma/envs/zkviz/lib/python3.7/site-packages/zkviz/plotly.py", line 158, in render
    fig = self.build_plotly_figure()
  File "/Users/pma/envs/zkviz/lib/python3.7/site-packages/zkviz/plotly.py", line 98, in build_plotly_figure
    text = "<br>".join([node, self.graph.node[node].get("title", "")])

Any clue for a use with Plotly ? (should more interactive ...)

oolonek commented 4 years ago

Ok. So the error comes indeed from line 98 in the plotly.py script.

should be (with nodes and not node) as described here

text = "<br>".join([node, self.graph.nodes[node].get("title", "")])

mamoit commented 4 years ago

This seems to have been fixed in master by https://github.com/Zettelkasten-Method/zkviz/commit/011426b1757b1dc95b02a92cab84ad8f1bef4066

DivineDominion commented 3 years ago

Fixed in a release version in v1.3.2 🎉