Avec certaines versions de Python, la séquence suivante est problématique :
Python 3.6.8 |Intel Corporation| (default, Apr 12 2019, 17:34:58) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux Type "help", "copyright", "credits" or "license" for more information. Intel(R) Distribution for Python is brought to you by Intel Corporation. Please check out: https://software.intel.com/en-us/python-distribution >>> import matplotlib as mpl >>> import matplotlib.pyplot Traceback (most recent call last): File "/usr/local/intel/2019.4.243/intelpython3/lib/python3.6/site-packages/matplotlib/backends/backend_webagg.py", line 27, in <module> import tornado ModuleNotFoundError: No module named 'tornado' During handling of the above exception, ... >>>
Le problème réside dans le "backend" qui n’est pas positionné correctement. Pour s’en sortir il suffit de positionner un backend correct, par exemple :
Python 3.6.8 |Intel Corporation| (default, Apr 12 2019, 17:34:58) [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux Type "help", "copyright", "credits" or "license" for more information. Intel(R) Distribution for Python is brought to you by Intel Corporation. Please check out: https://software.intel.com/en-us/python-distribution >>> import matplotlib as mpl >>> mpl.use("pdf") >>> import matplotlib.pyplot
Pour connaître l’ensemble des "backends" disponibles :
>>> mpl.rcsetup.all_backends ['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template'] >>>