Import error with Tkinter and python3.5 Import error with Tkinter and python3.5 tkinter tkinter

Import error with Tkinter and python3.5


sudo apt-get install python3-tk

This command will install tkinter for your default python3 only, so python3.5 ImportError.

You can run the following command to install for python3.5

sudo apt-get install python3.5-tk


Change the matplotlib backend to 'agg' or some other noninteractive option. Something like the following:

matplotlib.use('agg')

More info here (in the context of Docker, where I faced this issue and successfully solved it):


The python3-tk libraries were installed under the 3.2 version, not 3.5. Python3-tk was uninstalled and python3.5-tk was installed instead