2017-04-15 10 views
1

This ist ein Tutorial zur Visualisierung von Netzwerkdiagrammen mit Google Cloud Datalab.Kann Graphviz nicht in Google Cloud Datalab verwenden

Alles hat perfekt funktioniert (muss "gcp.bigquery" ändern, um "datalab.bigquery" [25]), bis:

In [35]: 

%%bash 
/usr/bin/yes | apt-get install graphviz 
pip install --upgrade graphviz 
/usr/bin/yes | pip uninstall pyparsing 
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz 
pip install --upgrade pydot 

Sobald ich pyparsing deinstalliert, kann der pip-Befehl nicht funktioniert und die nächsten 2 Zeilen können nicht korrekt ausgeführt werden.

Wenn ich die Zeilen im Zusammenhang mit pyparsing ignorieren, einfach installieren/Upgrade graphviz und pydot, wird ein Fehler in dieser Zeile auftritt in "In [67]:":

pos=nx.graphviz_layout(gmax, prog='circo') 

AttributeError: 'module' object has no attribute 'graphviz_layout'

I don‘ Ich denke, es ist eine pyparsing Angelegenheit. Vielleicht ist die graphviz Version der Punkt, da dieses Tutorial vor etwa 2 Jahren geschrieben wurde.

Irgendeine Idee?

Dank

+1

Mögliches Duplikat von [AttributeError: 'Modul' Objekt hat kein Attribut 'graphviz \ _layout' mit networkx 1.11] (http://stackoverflow.com/questions/39411102/attributeerror-module-object-has-no-attribute- graphviz-layout-mit-netzwerkx) – snakecharmerb

Antwort

2

Die Grafik Netzwerk korrekt angezeigt, nachdem ich

pos=nx.graphviz_layout(gmax, prog='circo') 

zu

pos=nx.nx_pydot.graphviz_layout(gmax, prog='circo') 

basierend auf this StackOverflow post geändert. Dies erforderte pydotplus, also habe ich auch eine der Zellen mit %%bash aktualisiert. Ich lief

%%bash 
apt-get update 
apt-get install -y graphviz 
pip install pydot 
pip install graphviz 
pip install pydotplus 

statt

%%bash 
/usr/bin/yes | apt-get install graphviz 
pip install --upgrade graphviz 
/usr/bin/yes | pip uninstall pyparsing 
pip install -Iv https://pypi.python.org/packages/source/p/pyparsing/pyparsing-1.5.7.tar.gz 
pip install --upgrade pydot 

Ich hoffe, das hilft!

Verwandte Themen