ModuleNotFoundError: No module named ‘tkinter’ in Python

Python is a popular programming language utilized in DataScience, Machine-Learning, GUI (Graphical User Interface), etc. To create a GUI interface, a popular framework named “tkinter” is used in Python. The “tkinter” framework is the only standard framework that comes along with the Python standard library. To access “tkinter” in Python, we need to install it in Python.

In this blog post, we will discuss various solutions for the no module named “tkinter” error using the below topics:

Reason: “tkinter” Module is Not Installed in Python

The prominent reason which causes the “no module named tkinter” error in Python is importing the “tkinter” module without installing it in, as shown below:

The above snippet shows the error because the tkinter module is imported into the program without installing.

Solution (For Windows): Make sure the “IDLE and tcl/tk” Options are Checked When Installing Python

To resolve this issue in windows, you need to tick the “IDLE and tcl/tk” options while installing Python. To do that, open the “Python” setup and click on the “Modify” option, as we did in the below snippet:

Check the “tcl/tk and IDLE” box from the optional features and hit the next button to install the “tkinter” module in Python.

Solution (For Linux): Install the “tkinter” Module

The “no module named tkinter” error is caused in Linux when the “tkinter” module is not installed in Python. To resolve this error in Linux, you can check this particular guide.

You can also use the given below command to resolve the error for Linux distributions:

$ sudo apt install python3-tk              #For UBUNTU and DEBIAN
$ sudo dnf install python3-tkinter         #For Fedora
$ sudo yum install python3-tkinter         #For CentOS

Solution (For MacOS): Install the “tkinter” Module in the Terminal

The stated error occurs in Python when the tkinter module is not installed in macOS. To install the tkinter module in macOS, you can use the below command:

brew install [email protected] # For macOS

Note: Use the Python version correctly while using this command, i.e., “python-tk@<version>”. For instance, if you are using Python v 3.9 on your computer, type the below command:

brew install [email protected]


The “tkinter” ModuleNotFoundError can be fixed in windows by installing the “tkinter” module at the time of installation of Python. The “apt”, “dnf”, and “yum” commands are used to install the “tkinter” module in Ubuntu, Fedora, and Centos Linux distributions. The “tkinter” module error in macOS can be resolved using the “brew” command in the terminal. This guide provided a complete guide on how to fix the “no module named ‘tkinter’” error in Python.