Results 1 to 7 of 7

Thread: python pyplot - no graph in SuSE, while other distros okay

  1. #1
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    18

    Default python pyplot - no graph in SuSE, while other distros okay

    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

  2. #2
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,296
    Blog Entries
    2

    Default Re: python pyplot - no graph in SuSE, while other distros okay

    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
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  3. #3

    Default Re: python pyplot - no graph in SuSE, while other distros okay

    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.

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    18

    Default Re: python pyplot - no graph in SuSE, while other distros okay

    Quote Originally Posted by tsu2 View Post
    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
    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

  5. #5
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    18

    Post Re: python pyplot - no graph in SuSE, while other distros okay

    Quote Originally Posted by grahmar View Post
    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.
    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:

    Code:
    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

  6. #6

    Default Re: python pyplot - no graph in SuSE, while other distros okay

    Quote Originally Posted by mhenatsch View Post
    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:
    Code:
    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
    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.

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    18

    Default Re: python pyplot - no graph in SuSE: resolved!

    Quote Originally Posted by mhenatsch View Post
    ... 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 . . .
    .
    .
    .
    but fails to show the graph.
    Mike
    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •