package pygraphviz Sagemath 8.6 (W10) [closed]

asked 2019-01-26 20:44:11 +0100

ortollj gravatar image

Hi is it possible to use package pygraphviz in Sagemath 8.6 (W10) ? if yes, how to ?

# Author: Aric Hagberg (hagberg@lanl.gov)

#    Copyright (C) 2004-2018 by
#    Aric Hagberg <hagberg@lanl.gov>
#    Dan Schult <dschult@colgate.edu>
#    Pieter Swart <swart@lanl.gov>
#    All rights reserved.
#    BSD license.

import networkx as nx

# and the following code block is not needed
# but we want to see which module is used and
# if and why it fails
try:
    import pygraphviz
    from networkx.drawing.nx_agraph import write_dot
    print("using package pygraphviz")
except ImportError:
    try:
        import pydot
        from networkx.drawing.nx_pydot import write_dot
        print("using package pydot")
    except ImportError:
        print()
        print("Both pygraphviz and pydot were not found ")
        print("see  https://networkx.github.io/documentation/latest/reference/drawing.html")
        print()
        raise

G = nx.grid_2d_graph(5, 5)  # 5x5 grid
write_dot(G, "grid.dot")
print("Now run: neato -Tps grid.dot >grid.ps")
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by ortollj
close date 2019-01-27 08:10:25.245687

Comments

Oops !, I close this post sorry. :Is this Sage for Windows? If so, it doesn't support installing optional packages yet.

iguananaut answer

I suppose I can only install this package, if I use the Linux VM ?

ortollj gravatar imageortollj ( 2019-01-27 08:09:46 +0100 )edit