From f73547238c458c7597cc258f5ffbb61e6e3cac49 Mon Sep 17 00:00:00 2001 From: Marko Bastovanovic Date: Sat, 24 Nov 2018 02:51:38 +0100 Subject: [PATCH] Give helpful message in case Matplotlib isn't working https://github.com/openai/spinningup/issues/1 --- spinup/utils/plot.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spinup/utils/plot.py b/spinup/utils/plot.py index e8d253dab..945ff97ac 100644 --- a/spinup/utils/plot.py +++ b/spinup/utils/plot.py @@ -1,4 +1,15 @@ -import seaborn as sns +import sys +try: + import seaborn as sns +except ImportError as e: + if "Python is not installed as a framework" in str(e): + print("It looks like you are using OSX and Anaconda setup, without " + "Matplotlib properly configured. \nIssuing this from the command " + "line should fix the problem:\n" + "echo \"backend: TkAgg\" >> ~/.matplotlib/matplotlibrc\n" + "For more info see " + "https://github.com/openai/spinningup/issues/1\n") + sys.exit(2) import pandas as pd import matplotlib.pyplot as plt import json