ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 21 Jan 2012 16:10:41 +0100can't use networkx.read_dot()https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/
When trying the following
import networkx
networkx.read_dot("foo.dot")
I get
ImportError Traceback (most recent call last)
/home/bla/tmp/<ipython console> in <module>()
/local/usr/share/sage/local/lib/python/networkx/drawing/nx_agraph.pyc in read_dot(path)
197 except ImportError:
198 raise ImportError, \
--> 199 "read_dot() requires pygraphviz: http://networkx.lanl.gov/pygraphviz"
200 A=pygraphviz.AGraph(file=path)
201 return from_agraph(A)
ImportError: read_dot() requires pygraphviz: http://networkx.lanl.gov/pygraphviz
It seems that I'm missing something really simple here. After a fair time browsing the documentation, however, I couldn't find what :(
Thanks in advance.Thu, 19 Jan 2012 18:36:09 +0100https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/Answer by Shashank for <p>When trying the following</p>
<pre><code>import networkx
networkx.read_dot("foo.dot")
</code></pre>
<p>I get</p>
<pre><code>ImportError Traceback (most recent call last)
/home/bla/tmp/<ipython console> in <module>()
/local/usr/share/sage/local/lib/python/networkx/drawing/nx_agraph.pyc in read_dot(path)
197 except ImportError:
198 raise ImportError, \
--> 199 "read_dot() requires pygraphviz: http://networkx.lanl.gov/pygraphviz"
200 A=pygraphviz.AGraph(file=path)
201 return from_agraph(A)
ImportError: read_dot() requires pygraphviz: http://networkx.lanl.gov/pygraphviz
</code></pre>
<p>It seems that I'm missing something really simple here. After a fair time browsing the documentation, however, I couldn't find what :(</p>
<p>Thanks in advance.</p>
https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?answer=13154#post-id-13154Have you installed the optional package
http://www.sagemath.org/packages/optional/dot2tex-2.8.7-2.spkg
If not this command won't work.
Run the command sage -i dot2tex-2.8.7-2 to install it.
You can find a list of optional packages at
http://www.sagemath.org/packages/optional/
Edit:
Sorry I posted that without trying it out just by looking at the manual, but I managed to solve the problem. Here are the steps I did to make it run.
1)
install optional package dot2tex
2)
install optional package graphviz from the same page (http://www.sagemath.org/packages/optional/)
3)
At the terminal type
$sage -sh
$easy_install pygraphviz
That way I was able to run a simple pygraphviz example.Thu, 19 Jan 2012 19:35:35 +0100https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?answer=13154#post-id-13154Comment by rc for <p>Have you installed the optional package </p>
<p><a href="http://www.sagemath.org/packages/optional/dot2tex-2.8.7-2.spkg">http://www.sagemath.org/packages/opti...</a></p>
<p>If not this command won't work.</p>
<p>Run the command sage -i dot2tex-2.8.7-2 to install it.</p>
<p>You can find a list of optional packages at </p>
<p><a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a></p>
<p>Edit:</p>
<p>Sorry I posted that without trying it out just by looking at the manual, but I managed to solve the problem. Here are the steps I did to make it run.</p>
<p>1)</p>
<p>install optional package dot2tex</p>
<p>2)</p>
<p>install optional package graphviz from the same page (<a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a>)</p>
<p>3)</p>
<p>At the terminal type </p>
<p>$sage -sh</p>
<p>$easy_install pygraphviz</p>
<p>That way I was able to run a simple pygraphviz example.</p>
https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20483#post-id-20483I did not have dot2tex installed. Now I have but the situation is unchanged: same error message. Thanks for the ready answer anyway!Fri, 20 Jan 2012 08:53:44 +0100https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20483#post-id-20483Comment by rc for <p>Have you installed the optional package </p>
<p><a href="http://www.sagemath.org/packages/optional/dot2tex-2.8.7-2.spkg">http://www.sagemath.org/packages/opti...</a></p>
<p>If not this command won't work.</p>
<p>Run the command sage -i dot2tex-2.8.7-2 to install it.</p>
<p>You can find a list of optional packages at </p>
<p><a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a></p>
<p>Edit:</p>
<p>Sorry I posted that without trying it out just by looking at the manual, but I managed to solve the problem. Here are the steps I did to make it run.</p>
<p>1)</p>
<p>install optional package dot2tex</p>
<p>2)</p>
<p>install optional package graphviz from the same page (<a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a>)</p>
<p>3)</p>
<p>At the terminal type </p>
<p>$sage -sh</p>
<p>$easy_install pygraphviz</p>
<p>That way I was able to run a simple pygraphviz example.</p>
https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20477#post-id-20477It did! Thanks a lot! Where should I have looked in order figure this?
Sat, 21 Jan 2012 09:08:47 +0100https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20477#post-id-20477Comment by Shashank for <p>Have you installed the optional package </p>
<p><a href="http://www.sagemath.org/packages/optional/dot2tex-2.8.7-2.spkg">http://www.sagemath.org/packages/opti...</a></p>
<p>If not this command won't work.</p>
<p>Run the command sage -i dot2tex-2.8.7-2 to install it.</p>
<p>You can find a list of optional packages at </p>
<p><a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a></p>
<p>Edit:</p>
<p>Sorry I posted that without trying it out just by looking at the manual, but I managed to solve the problem. Here are the steps I did to make it run.</p>
<p>1)</p>
<p>install optional package dot2tex</p>
<p>2)</p>
<p>install optional package graphviz from the same page (<a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a>)</p>
<p>3)</p>
<p>At the terminal type </p>
<p>$sage -sh</p>
<p>$easy_install pygraphviz</p>
<p>That way I was able to run a simple pygraphviz example.</p>
https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20479#post-id-20479I have updated the answer. Hope this time it worksSat, 21 Jan 2012 01:04:26 +0100https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20479#post-id-20479Comment by Shashank for <p>Have you installed the optional package </p>
<p><a href="http://www.sagemath.org/packages/optional/dot2tex-2.8.7-2.spkg">http://www.sagemath.org/packages/opti...</a></p>
<p>If not this command won't work.</p>
<p>Run the command sage -i dot2tex-2.8.7-2 to install it.</p>
<p>You can find a list of optional packages at </p>
<p><a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a></p>
<p>Edit:</p>
<p>Sorry I posted that without trying it out just by looking at the manual, but I managed to solve the problem. Here are the steps I did to make it run.</p>
<p>1)</p>
<p>install optional package dot2tex</p>
<p>2)</p>
<p>install optional package graphviz from the same page (<a href="http://www.sagemath.org/packages/optional/">http://www.sagemath.org/packages/opti...</a>)</p>
<p>3)</p>
<p>At the terminal type </p>
<p>$sage -sh</p>
<p>$easy_install pygraphviz</p>
<p>That way I was able to run a simple pygraphviz example.</p>
https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20473#post-id-20473Unfortunately this is not mentioned in the sage manual. I just realized that pygraphviz is not install along with dot2tex as it should be according to the manual. easy_install is the standard procedure for installing modules are not listed under optional sage packages. So I tried it and it worked.Sat, 21 Jan 2012 16:10:41 +0100https://ask.sagemath.org/question/8641/cant-use-networkxread_dot/?comment=20473#post-id-20473