0

i have never had this issue before. how can i fix this ? it says no module named tkinter

(env_maskrcnn) haziq@vita-workstation2:~/human-pose-estimation$ ./run.sh
Traceback (most recent call last):
  File "pose_estimation/valid.py", line 32, in <module>
    import dataset
  File "/home/haziq/human-pose-estimation/pose_estimation/../lib/dataset/__init__.py", line 12, in <module>
    from .coco import COCODataset as coco
  File "/home/haziq/human-pose-estimation/pose_estimation/../lib/dataset/coco.py", line 19, in <module>
    from pycocotools.coco import COCO
  File "/home/haziq/.local/lib/python3.6/site-packages/pycocotools/coco.py", line 49, in <module>
    import matplotlib.pyplot as plt
  File "/home/haziq/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2374, in <module>
    switch_backend(rcParams["backend"])
  File "/home/haziq/.local/lib/python3.6/site-packages/matplotlib/pyplot.py", line 207, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/haziq/.local/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
    from . import _backend_tk
  File "/home/haziq/.local/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 5, in <module>
    import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'
0

Try run:

sudo apt install python3-tk

It will install tkinter module for python 3.

0

There are a plethora of choices - use apt-cache search tkinter and you'll see:

$ apt-cache search tkinter
idle - IDE for Python using Tkinter (default version)
idle-python2.7 - IDE for Python (v2.7) using Tkinter
idle3 - IDE for Python using Tkinter (default version)
python-tk - Tkinter - Writing Tk applications with Python
python-tk-dbg - Tkinter - Writing Tk applications with Python (debug extension)
python3-tk - Tkinter - Writing Tk applications with Python 3.x
python3-tk-dbg - Tkinter - Writing Tk applications with Python 3.x (debug extension)
idle-python3.5 - IDE for Python (v3.5) using Tkinter
libsnack-alsa - Sound extension to Tcl/Tk and Python/Tkinter - ALSA files
libsnack-oss - Sound extension to Tcl/Tk and Python/Tkinter - OSS files
pypy-tk - Tkinter module for PyPy (an alternative Python interpreter)
python-easygui - module for very simple, very easy GUI programming in Python
python-editobj - Python object editor
python-opengl - Python bindings to OpenGL (Python 2)
python-pmw - Pmw -- Python MegaWidgets
python-pmw-doc - Pmw -- Python MegaWidgets
python-tksnack - Sound extension to Tcl/Tk and Python/Tkinter - Python 2.x library
python3-easygui - module for very simple, very easy GUI programming in Python3
python3-opengl - Python bindings to OpenGL (Python 3)
python3-tksnack - Sound extension to Tcl/Tk and Python/Tkinter - Python 3.x library
tcl-snack - Sound extension to Tcl/Tk and Python/Tkinter - Tcl/Tk library
tcl-snack-dev - Sound extension to Tcl/Tk and Python/Tkinter - development files
tcl-snack-doc - Sound extension to Tcl/Tk and Python/Tkinter - documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.