0

I am running Debian 8.7 (Jessie) on a development laptop. I am just getting into Python development for some machine learning projects I am working on. I also have Python installed on a my main Mac OSX macbook as well.

While working on some examples, the OSX install, when using plt.show() (from Matplotlib/pyplot), a window will pop up with the plot. On the Debian laptop, however, I get nothing back. No errors, nothing. I changed the plt.show() command to just save the figure out to a file and that works.

I read some forums and posts that talk about installing ImageMagick and other tools. I have tried that, but that didn't seem to work. Another option was to change the "backends". I also read something about using "eog" instead of the xv or display provided by the base OS. The post is located here:

matplotlib does not show my drawings although I call pyplot.show()

I went through this process, but that doesn't seem to work either. I'm wondering if this has something to with the fact that I had to download, configure and make the Python 3.6.1 version I am running on the Linux side. I'm still a little new at Python, so I'm unsure how to solve this.

Info:

OS: Debian 8.7 (Debian) Python Version: 3.6.1 Packages Installed: pandas, matplotlib, bokeh, scikit-learn (and all the other major data science and machine learning libraries/packages). I used pip3.6 to install these, since the default python install is 2.7.9 on the OS.

Please let me know if there is more information needed. Thanks!

Community
  • 1
  • 1
azdatasci
  • 801
  • 1
  • 13
  • 32
  • Are you using a graphical desktop environment like Gnome? If not, that already explains the situation. If yes, please provide more information about how you interact with Python and whether you are able to run other graphical programs like `xlogo` without problems. – tripleee Apr 06 '17 at 04:49
  • Ah, yes. I am using OpenBox - I like to keep a minimal desktop. Other than the typical xorg server that requires, I using tint2 as my tool bar and some conky stuff for system stats. "xlogo" does work. – azdatasci Apr 06 '17 at 04:58
  • Anything in `$HOME/.xsession-errors`? – tripleee Apr 06 '17 at 05:04
  • No errors at all in .xession-errors – azdatasci Apr 06 '17 at 05:21
  • Could this have something to do with the fact I had to build Python 3.6.1? I did this, because apt-get only provides 3.4, and I wanted to be running the most current stable. – azdatasci Apr 06 '17 at 05:22

1 Answers1

1

Have you tried checking whether you're using python 3.6 instead of the 2.7? Try checking your bashrc.

I had a similar problem before with seaborn because i was using 2.7 at first and changed to 3.6. I used spyder now so my default python and projects will not get confused. Or you could try Python Virtual Environment.

nrmb
  • 460
  • 1
  • 6
  • 17
  • When I run the script, I am explicitly running: python3.6 example.py. If I check the version with python3.6 --version, I get 3.6.1 back. I won't change the default in my .bashrc, as for these examples, I can explicitly call python3.6 when running any scripts. – azdatasci Apr 06 '17 at 21:49
  • I see. Have you tried accessing: `matplotlib.get_backend()` on the terminal? does it give you the value `agg` ? – nrmb Apr 07 '17 at 08:42