From 55e4682ed0f4a37a6f36894bfe4c78965e1bdd3e Mon Sep 17 00:00:00 2001 From: Carles Sala Date: Fri, 4 Sep 2020 18:25:29 +0200 Subject: [PATCH] Add graphviz install warning if binaries not found --- sdv/metadata/visualization.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sdv/metadata/visualization.py b/sdv/metadata/visualization.py index b18b76879..e401c306e 100644 --- a/sdv/metadata/visualization.py +++ b/sdv/metadata/visualization.py @@ -1,5 +1,7 @@ """Functions for Metadata visualization.""" +import warnings + import graphviz @@ -120,4 +122,14 @@ def visualize(metadata, path=None): if filename: digraph.render(filename=filename, cleanup=True, format=graphviz_extension) else: + try: + graphviz.version() + except graphviz.ExecutableNotFound: + warning_message = ( + 'Graphviz does not seem to be installed on this system. For full ' + 'metadata visualization capabilities, please make sure to have its ' + 'binaries propertly installed: https://graphviz.gitlab.io/download/' + ) + warnings.warn(warning_message, RuntimeWarning) + return digraph