I’m trying to use matplotlib from pyroot using snap-installed root. It complains that matplotlib is not using a GUI backend. See below
jake@jake-XPS-13-9310:~$ pyroot
Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.plot([0, 1], [0, 1])
[<matplotlib.lines.Line2D object at 0x7fb8659f67c0>]
>>> plt.show()
<stdin>:1: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
ROOT Version: 6.26/10
Built for linuxx8664gcc on Apr 07 2023, 16:46:00
From tags/v6-26-10@v6-26-10
I’d imagine the snap needs to be updated to include TKinter, it’s implicit on MacOS and Windows but on Linux it’s usually a separate module and it must be lacking.
I’ll update the latest version of the ROOT snap (6.28.x or “latest” in the snap channels) to have TKinter in the next few days. I assume because you’re using Python 3.8, you’re on an older release of ROOT, since I’d expect it to be Python 3.10 now, you might need to run an update explicitly since I’m assuming your device is following a older release channel.
I’m still trying to get TKinter to work, it turns out the TCL environment it relies on creates some complications; hopefully I’ll have some time to have a second attempt over the weekend.
In the meantime, I thought it was probably worth mentioning the JupyROOT backend will still work just fine with Matplotlib if you’re interested in that, you can access it with just root --notebook in the terminal, e.g