Backend reconfiguration only in Python2
@@ -55,13 +55,15 @@ Misc Functions
'''
import os
+import sys
import matplotlib as mpl
-# # if running on remote mode on a linux server which does not have a display (like Docker images for CI)
-# if os.name == 'posix' and not os.environ.get('DISPLAY', '') and mpl.rcParams['backend'] != 'agg':
-# print('No display found. Using non-interactive Agg backend.')
-# # https://matplotlib.org/faq/usage_faq.html
-# mpl.use('Agg')
+# if running on remote mode on a linux server which does not have a display (like Docker images for CI)
+# seems to cause problems only in Python2, so let's try reconfiguring the backend only in that case
+if os.name == 'posix' and not os.environ.get('DISPLAY', '') and mpl.rcParams['backend'] != 'agg' and sys.version.startswith('2'):
+ print('No display found. Using non-interactive Agg backend.')
+ # https://matplotlib.org/faq/usage_faq.html
+ mpl.use('Agg')
from matplotlib import ticker
import matplotlib.pyplot as plb
import numpy as npy
