Matplotlib backend missing modules with underscore




I've been using matplotlib for some time without problems. It's been a while since i needed the interactive plot functions (for which Tkaag was used). Since then i updated matplotlib a few times.


I tried to use it today, but it spawned an error.



```
/usr/local/lib/python2.7/dist-packages/matplotlib/backends/tkagg.py in <module>()
> 1 import _tkagg
      2 import Tkinter as Tk
      3 
      4 def blit(photoimage, aggimage, bbox=None, colormode=1):
      5     tk = photoimage.tk

ImportError: No module named _tkagg

```

I tried a different backend, added the 



```
backend      : GTKAgg

```

to matplotlibrc. Just to get the same error for a different module.



```
ImportError: No module named _backend_gdk

```

When I browsed for backends in /usr/local/lib/python2.7/dist-packages/matplotlib/backends/ i've noticed that all the required modules with underscore are missing.



```
alan@linux /usr/local/lib/python2.7/dist-packages/matplotlib/backends $ ls
backend_agg.py        backend_macosx.py    backend_template.pyc
backend_agg.pyc       backend_macosx.pyc   backend_tkagg.py
_backend_agg.so       backend_mixed.py     backend_tkagg.pyc
backend_cairo.py      backend_mixed.pyc    backend_wxagg.py
backend_cairo.pyc     backend_pdf.py       backend_wxagg.pyc
backend_cocoaagg.py   backend_pdf.pyc      backend_wx.py
backend_cocoaagg.pyc  backend_ps.py        backend_wx.pyc
backend_emf.py        backend_ps.pyc       __init__.py
backend_emf.pyc       backend_qt4agg.py    __init__.pyc
backend_fltkagg.py    backend_qt4agg.pyc   Matplotlib.nib
backend_fltkagg.pyc   backend_qt4.py       qt4_compat.py
backend_gdk.py        backend_qt4.pyc      qt4_compat.pyc
backend_gdk.pyc       backend_qtagg.py     qt4_editor
backend_gtkagg.py     backend_qtagg.pyc    tkagg.py
backend_gtkagg.pyc    backend_qt.py        tkagg.pyc
backend_gtkcairo.py   backend_qt.pyc       windowing.py
backend_gtkcairo.pyc  backend_svg.py       windowing.pyc
backend_gtk.py        backend_svg.pyc
backend_gtk.pyc       backend_template.py

```

My current matplotlib version:



```
matplotlib      - 1.1.1        - active development (/usr/local/lib/python2.7/dist-packages)

```

I've tried uninstalled and reinstalling matplotlib with:



```
pip uninstall matplotlib
pip install matplotlib

```

and all went well.


Tips on setting on getting interactive plotting running again?



```
    BUILDING MATPLOTLIB

                matplotlib: 1.1.1

                    python: 2.7.3rc2 (default, Apr 22 2012, 22:35:38)  [GCC

                            4.6.3]

                  platform: linux2



    REQUIRED DEPENDENCIES

                     numpy: 1.6.2

                 freetype2: 14.1.8



    OPTIONAL BACKEND DEPENDENCIES

                    libpng: 1.2.49

                   Tkinter: no

                            * Using default library and include directories for

                            * Tcl and Tk because a Tk window failed to open.

                            * You may need to define DISPLAY for Tk to work so

                            * that setup can determine where your libraries are

                            * located. Tkinter present, but header files are not

                            * found. You may need to install development

                            * packages.

                pkg-config: looking for pygtk-2.0 gtk+-2.0

                            * Package pygtk-2.0 was not found in the pkg-config

                            * search path. Perhaps you should add the directory

                            * containing `pygtk-2.0.pc' to the PKG_CONFIG_PATH

                            * environment variable No package 'pygtk-2.0' found

                            * Package gtk+-2.0 was not found in the pkg-config

                            * search path. Perhaps you should add the directory

                            * containing `gtk+-2.0.pc' to the PKG_CONFIG_PATH

                            * environment variable No package 'gtk+-2.0' found

                            * You may need to install 'dev' package(s) to

                            * provide header files.

                      Gtk+: no

                            * Could not find Gtk+ headers in any of

                            * '/usr/local/include', '/usr/include', '.'

           Mac OS X native: no

                        Qt: no

                       Qt4: Qt: 4.8.1, PyQt4: 4.9.1

                    PySide: no

                     Cairo: 1.8.8



    OPTIONAL DATE/TIMEZONE DEPENDENCIES

                  datetime: present, version unknown

                  dateutil: matplotlib will provide

                      pytz: matplotlib will provide

    adding pytz



    OPTIONAL USETEX DEPENDENCIES

                    dvipng: 1.14

               ghostscript: 9.05

                     latex: 3.1415926

                   pdftops: 0.18.4

```
Thanks to peison's comment I've checked the installation log for matplotlib and it showed lots of dependencies.


I haven't noticed that before because the whole process of instalation ran really fast using


`pip install matplotlib`


and ended with a succesfull install.


To answer the question. The solution was to install packages tk and tk-dev, and rebuild matplotlib.
hi yerhu,

i could imagine, that one of the two following scenarios may cause the issue:

you’re using an outdated version of tk-core. check in your configuration: core/core\_api.yml

you’re using a pipelineconfiguration, which is pointing to a local-path and includes a file like python\_interpreter, i… You don't need to install it: it is part of the python standard library. Look in the standard's library documentation for reference. I think that the Parallel Studio installer contains Scalapack as a selectable component, and Scalapack is installed if the "cluster option" is selected during installation. 


It is also possible that your system has a version of Scalapack that was obtained from a Linux distro/repository, so the details vary. 


Please consult your system administrator (even if that is yourself!) regarding what components are installed on your system.




[View solution in original post](/t5/Intel-oneAPI-Math-Kernel-Library/Intel-Fortran-Compiler-MK-Library-Installation-Problem/m-p/1207327#M30013) what to do::

docker exec -it gitlab /bin/bash

then

apt install update-manager-core

then

do-release-upgrade hi,

do you have joy package installed with all necessary packages/dependencies ?

try to search for joy\_node or run joy package examples to find out what is going wrong. really weird. after disabling all of my plugins, then enabling them one by one (and restarting octoprint each time), files load fine now with all plugins enabled. my backend is octopi and it's running on a pi 2. never had any issues before upgrading but now seems to be working for the moment with… A couple of notes to get started:



> 
> .apply(literal\_eval)
> 
> 
> 


Wouldn't this be better as `map`?



> 
> I then re-create the Dask DF:
> 
> 
> ddf = dd.from\_pandas(ddf\_out, npartitions=nCores)
> 
> 
> 


`ddf_out` was already a dask dataframe, I don't know why you had to do this.



> 
> The columns in result seem to match those in metadir.
> 
> 
> 


The value of `result.columns` is taken from the meta you provided, no computing happens until you ask for it (dask is lazy in most operations). Does the ValueError exception not provide further information?


Here is a full example



```
x = ({'F9_07_PZ_COMP_DIRECT': '0',
  'F9_07_PZ_DIRTRSTKEY_NAME': 'DEBRA MEALY',
  'F9_07_PZ_COMP_OTHER': '0',
  'F9_07_PZ_COMP_RELATED': '0',
  'F9_07_PZ_TITLE': 'CHAIR PERSON',
  'F9_07_PZ_AVE_HOURS_WEEK': '1.00',
  'F9_07_PC_TRUSTEE_INDIVIDUAL': 'X'},
 {'F9_07_PZ_COMP_DIRECT': '0',
  'F9_07_PZ_DIRTRSTKEY_NAME': 'HELEN GORDON',
  'F9_07_PZ_COMP_OTHER': '0',
  'F9_07_PZ_COMP_RELATED': '0',
  'F9_07_PZ_TITLE': 'VICE CHAIR',
  'F9_07_PZ_AVE_HOURS_WEEK': '1.00',
  'F9_07_PC_TRUSTEE_INDIVIDUAL': 'X'})
df = pd.DataFrame({'a': x})
d = dd.from_pandas(df, 1)
meta = pd.DataFrame(columns=['F9_07_PZ_COMP_DIRECT', 
       'F9_07_PZ_DIRTRSTKEY_NAME',
       'F9_07_PZ_COMP_OTHER', 'F9_07_PZ_COMP_RELATED', 'F9_07_PZ_TITLE',
       'F9_07_PZ_AVE_HOURS_WEEK', 'F9_07_PC_TRUSTEE_INDIVIDUAL'], dtype="O")
d.map_partitions(lambda df: df.a.apply(pd.Series), meta=meta).compute()

```

How did I know what `meta` to use? I applied the function to the pandas dataframe - you might use a small piece of the dataframe to do this.


Some additional notes:


* it is an anti-pattern to load the data with pandas, pass to dask workers and then gather the whole result back to a pandas (in memory) dataframe, you are very unlikely to see a speedup this way and may incur a lot of overhead. You are better off loading with something like `dd.read_csv`, and aggregating or writing with dask functions too. Only `compute()` on something that will be small or not return anything (because it involves writing the output). The official examples do not use from\_pandas.
* string and dict processing are python methods, and so hold the interpreter lock (GIL) of any python function: threads will not actually run in parallel. To get parallelism, you need to run in processes, which is most easily achieved using <https://docs.dask.org/en/latest/setup/single-distributed.html>
* the distributed scheduler also gives you access to the dashboard, which has a lot of useful information to diagnose how your system is running. You can also configure a lot about its behaviour, in case you have firewall rules you need to obey. you got this error because the image is not in the local working directory and is your home folder. pandoc does not know where to find it with ~. 
i think you should use full path by expanding your image file path so that pandoc gets it. 
also, you can use knitr::include\_graphics to include images i… hi,

sorry for the late update.

the error is not caused by the pytorch installation.

it occurs when apt sever want to re-try the not fully installed package (nvidia-l4t-bootloader).

would you mind to remove the installation job and try it again?

$ apt-get --force-yes remove <pkgname>

if the iss… thanks for your comment!

i definitely should’ve used mkshell, not sure why i wasn’t. it does seem to produce a different error:

make: entering directory '/build/source/doc/manual'

xsltproc --nonet --param section.autolabel 1 --param section.label.includes.component.label 1 --param html.stylesheet …