As a beginner to Python I have written an application (mostly copied from other sources) on my Raspberry Pi for collecting temperature data and visualizing these in a graph.
Everything runs well on the Raspberry Pi and under Manjaro Linux, but under Leap 42.3 or Leap 15.0 the program runs to the end without any errors but no graphic is output. Also running test code from the python command line, no graph is output under Leap 42.3 / 15.0. Since none of these problems show up under Raspbian or Manjaro I conclude that this is a problem specific to SuSE.
Python version is 3.6.5. To create the graph I use matplotlib.pyplot 2.0.2, downloaded with Yast from Open Suse, and, as stated above, this works allright on the other two distros.
Any ideas where I should look for a configuration anomaly?
Mike
Seems to me there was another Forum thread about Pyplot issues awhile back…
You should search this Forum for that thread.
IIRC the User addressed the problem through a workaround… Installed Anaconda and used pyplot from that…
Looks like the following bug has been reported, if it doesn’t sound like it could be related to your problem you should submit a new bug…
https://bugzilla.opensuse.org/show_bug.cgi?id=1116449
TSU
Python Matplotlib defaults to Agg to display plots.
You can change this by editing /usr/lib64/python3.6/site-packages/matplotlib/mpl-data/
I use TkAgg but there are other choices listed in that file.
Apologies for being unresponsive so long. I have been away from my computer for a few days.
I did search the forum but no luck.
I would prefer not to install Anaconda. I have yet to grasp the very basics of Python and therefore want to keep things simple.
The bug you mentioned seems to be of another nature.
If I don’t get this resolved myself (with help from you kind people) I will file a bug report.
Mike
Assuming you mean the file ‘matplotlibrc’ in the directory you mentioned I found the line “backend : Agg” (the only line in the whole file that was not commented out) and changed it to “backend : TkAgg”. This resulted in my program now throwing an exception (effectively complaining “ImportError: No module named ‘matplotlib.backends.backend_tkagg’).
Checked the backends directory I found that there indeed is no such module (but lots of other modules).
In my Manjaro installation there is a file 'backend_tkagg.py”. Also, in the Manjaro installation - as opposed to the Suse installation - the line “backend : Agg” is commented out. I copied the ‘backend_tkagg.py’ from Manjaro to Suse - to no avail. I then commented out the a. m. line (#backend : Agg) in the matplotlibrc to make it like the the matplotlibrc in Manjaro - still no success. The program runs without any errors but does not create a graph.
What I find really puzzling is that the exact same code runs perfectly well under Manjaro, including a nice graph, but under Suse it merely prints these lines:
We reached the final steps.
Zeit: 2019-03-08 15:45:10 Temperatur: 17.8
Zeit: 2019-03-08 15:45:12 Temperatur: 17.8
<function ylabel at 0x7f020cb676a8>
<function xlabel at 0x7f020cb67620>
<function show at 0x7f020cb63bf8>
but fails to show the graph.
(Note: the first three lines result from print commands I have in the code temporarily in order to check program progress)
Mike
Several files need to be installed for TKAgg to be used. tk, python3-tk, python3-matplotlib-tk, and maybe more will be pulled in. I you already have those installed, I would suggest you try one of the other backends you have installed. Other than that, I wouldn’t know what else to try.
Looks like I have finally resolved this issue.
I had installed matplotlib with Yast, with the result that no graph was generated by my program. I have now inspected (in Yast) the ‘Technical Data’ for matplotlib and found the following:
License: SUSE-Matplotlib
Vendor: openSUSE
Packager: http://bugs.opensuse.org
Source Package: python3-matplotlib-1.4.3-4.26
From this information I concluded that openSUSE’s matplotlib was apparently a non-standard version. I therefore uninstalled matplotlib (again with Yast) and then installed it anew from the command line with “pip3 install matplotlib”. This got me the original version of the library, and since then all runs well - including the generation of graphs!
I have yet to find out how to issue a bug report and to whom to send it. Any assistance in this?
Thanks
Mike