Skip to content

Instantly share code, notes, and snippets.

@necojackarc
Last active April 13, 2017 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save necojackarc/124b9e6a131b5dcf22ef2e22572ce97d to your computer and use it in GitHub Desktop.
Save necojackarc/124b9e6a131b5dcf22ef2e22572ce97d to your computer and use it in GitHub Desktop.
How to Install Matplotlib with Tk Backend on openSUSE

Matplotlib's default background is agg, which doesn't have GUI. It means that show() doesn't show any plots on GUI.

That will never show any window, your matplotlib is configured to use agg, which is no gui version of output. Install a gui backend like python-matplotlib-qt4, python-matplotlib-tk and try again. https://forums.opensuse.org/showthread.php/494173-matplotlib-fails-to-show-plots-after-latest-update-from-the-Sciencerepolistory

So, let's configure Matplotlib to use TkAgg, which is really easy to set up:

$ sudo zypper in tk-devel
$ pyenv install 3.6.1
$ pip install numpy matplotlib

Matplotlib requires TkInter, and tk-devel must be installed before building Python.

ref: https://wiki.python.org/moin/TkInter

Then, open matplotlibrc to set the backend to TkAgg:

$ vi ~/.config/matplotlib/matplotlibrc

Put the backend setting like this:

backend: TkAgg

That's it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment