GuardUtil Graph not Generating Network Graph due to unmet Networkx dependency.
On a fresh Guardian installation the command guardutil graph fails. The problem is that the module Networkx can't import the module PyDot. Find the code snippet below:
$ guardutil graph SUS_LOCK -o SUS_LOCK_rev1__20200402.pdf
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/dist-packages/guardian/guardutil.py", line 507, in <module>
main()
File "/usr/lib/python2.7/dist-packages/guardian/guardutil.py", line 504, in main
args.func(args)
File "/usr/lib/python2.7/dist-packages/guardian/guardutil.py", line 153, in draw_graph
edge_constraints=args.constraints,
File "/usr/lib/python2.7/dist-packages/guardian/graph.py", line 208, in sys2dot
dot = to_pydot(G)
File "/usr/lib/python2.7/dist-packages/networkx/drawing/nx_pydot.py", line 199, in to_pydot
pydot = _import_pydot()
File "/usr/lib/python2.7/dist-packages/networkx/drawing/nx_pydot.py", line 362, in _import_pydot
import pydot
ImportError: No module named pydot
A look at the installed module reveals the following:
$ apt search pydot
Sorting... Done
Full Text Search... Done
python-pydot/stable 1.4.1-1 all
Python interface to Graphviz's dot
python-pydot-ng/stable 1.0.0-3 all
interface to Graphviz's Dot - Python 2.7
python-pydotplus/stable,now 2.0.2-2 all [installed,automatic]
interface to Graphviz's Dot language - Python 2.7
python-pydotplus-doc/stable 2.0.2-2 all
interface to Graphviz's Dot language - doc
python3-pydot/stable 1.4.1-1 all
Python interface to Graphviz's dot (Python 3)
python3-pydotplus/stable,now 2.0.2-2 all [installed,automatic]
interface to Graphviz's Dot language - Python 3.x
The code for the specific Guardian is attached.SUS_LOCK.py