You probably need to install it using something similar to the following:

  • For Ubuntu or other distros with Apt:

    sudo apt-get install python3-tk
    
  • For Fedora:

    sudo dnf install python3-tkinter
    

You can also mention a Python version number like this:

  • sudo apt-get install python3.7-tk
    
  • sudo dnf install python3-tkinter-3.6.6-1.fc28.x86_64
    

Finally, import tkinter (for Python 3) or Tkinter (for Python 2), or choose at runtime based on the version number of the Python interpreter (for compatibility with both):

import sys
if sys.version_info[0] == 3:
    import tkinter as tk
else:
    import Tkinter as tk
Answer from d-coder on Stack Overflow
Top answer
1 of 4
5

Just re-install python..

tkinter (and the associated system libraries it needs) are meant to be included by default with any version of python you install. If it got deleted or corrupted (or not installed in the first place), it is easiest often just to re-install python. If you want to keep all the libraries you've already installed, copy c:\Python38\Lib\site-packages somewhere safe, then you can go ahead and delete the python folder. Next you'll want to search using the start menu for "environment variables", and select "edit environment variables for your account". Select the "Path" variable, and click the "edit" button. Delete any entries referring back to the python folder you just deleted.

The recommended windows installer from python.org for 3.8.7 includes several options if you "customize installation" including whether or not to install tkinter as well as where you want to install.Checking the entry for "add to PATH" will ensure that when you type "python" into a cmd prompt; it works. You can then move your old "site-packages" folder back to your python folder in the same location "pyfolder\Lib\site-packages". If you install a different version of python you should re-install any libraries rather than copying them, but saving site-packages will at least give you a list of what you need to go install.

2 of 4
2

I also had the same problem (on Windows 10) but with python 3.10.0. PyCharm could not install it for me, it suggested installing Future for some reason. The following solved the problem for me:

(I still had the python installer exe among my Downloads. If you do not have it, download it from here.)

Run the installer, choose Modify (Add or remove individual features), tick tcl/tk and IDLE.

I did not have to edit my PATH or re-install previously installed modules.

Discussions

No module named 'tkinter' in Pycharm on Windows 10
Operating System Windows 10 Python version 3.x IDE: Pycharm Community 2020 . 3 I wish I could provide more info, but the code below does not run at all, same error message. import PySimpleGUI as sg print(sg) # Location of your PySimpleGU... More on github.com
🌐 github.com
8
December 6, 2020
Tkinter ModuleNotFoundError
Good day, I am new to Python and tried to use tkinter. I use Windows. The following is what I entered and received. I uninstalled and re-installed Python 3.8.1 to see if there are any options that I can select to include tkiner, but there were no options to select. More on discuss.python.org
🌐 discuss.python.org
3
1
February 20, 2020
python - matplotlib error - no module named tkinter - Stack Overflow
I tried to use the matplotlib package via Pycharm IDE on windows 10. when I run this code: from matplotlib import pyplot I get the following error: ImportError: No module named 'tkinter' I know t... More on stackoverflow.com
🌐 stackoverflow.com
No module named tkinter
I have installed everything correctly, but I am getting this error when running the gui.bat 21:17:58-617439 INFO Version: v21.7.16 21:17:58-617439 INFO nVidia toolkit detected 21:18:00-679888 INFO ... More on github.com
🌐 github.com
6
July 7, 2023
🌐
Reddit
reddit.com › r/tkinter › modulenotfounderror: no module named 'tkinter' - cannot run tkinter in visual studio code
r/Tkinter on Reddit: ModuleNotFoundError: No module named 'tkinter' - Cannot run tkinter in Visual Studio Code
November 4, 2022 -

Hi everyone,

Im working in a project using Python and I ran into an issue regarding tkinter. The first time a execute the testing code:

from tkinter import *
from tkinter import ttk
root = Tk()
frm = ttk.Frame(root, padding=10)
frm.grid()
ttk.Label(frm, text="Hello World!").grid(column=0, row=0)
ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0)
root.mainloop()

Gave me the following error --> ModuleNotFoundError: No module named 'tkinter'

Im using Fedora so I proceed installing tkinter using "sudo dnf install python3-tkinter" command. And when I run "python3 -m tkinter" from terminal it shows the pop-up window. But i keep ran in into the same error when I execute the code from VSC.

Anyone had an idea of how to solve this?

thank you all!

🌐
Python Forum
python-forum.io › thread-27981.html
No module named 'Tkinter'
I'm a beginner, and from my first steps, I have a strange problem. No matter what I have done (google it, set a virtual environment, reinstalling the language several times, installing deferent versions of the language) when I'm trying to give the co...
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 360006480380-No-module-named-tkinter
No module named 'tkinter' – IDEs Support (IntelliJ Platform) | JetBrains
October 26, 2019 - TL;DR: Install the python3-tk package because your base python is python3 (not python) and python-tk and python3-tk are two distinct packages. ... The command sudo apt install python3-tk resolved the issue for me as well.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-no-module-named-tkinter
ModuleNotFoundError: No module named 'tkinter' in Python | bobbyhadz
April 8, 2024 - Once you activate the virtual environment, try running your script directly with python script_name.py. If the error persists, make sure you haven't named a module in your project as tkinter.py because that would shadow the original tkinter module.
🌐
GitHub
github.com › PySimpleGUI › PySimpleGUI › issues › 3692
No module named 'tkinter' in Pycharm on Windows 10 · Issue #3692 · PySimpleGUI/PySimpleGUI
December 6, 2020 - There is not tkinter module available in Pycharm, there are 20 with the name in it, but no main module that seems to provide the basic tkinter.
Author   raspitakesovertheworld
Find elsewhere
🌐
GitHub
github.com › bmaltais › kohya_ss › issues › 1128
No module named tkinter · Issue #1128 · bmaltais/kohya_ss
July 7, 2023 - 21:17:58-617439 INFO Version: v21.7.16 21:17:58-617439 INFO nVidia toolkit detected 21:18:00-679888 INFO Torch 2.0.1+cu118 21:18:00-711140 INFO Torch backend: nVidia CUDA 11.8 cuDNN 8700 21:18:00-711140 INFO Torch detected GPU: NVIDIA GeForce RTX 3060 VRAM 12287 Arch (8, 6) Cores 28 21:18:00-711140 INFO Verifying modules instalation status from requirements_windows_torch2.txt... 21:18:00-711140 INFO Verifying modules instalation status from requirements.txt... Traceback (most recent call last): File "D:\kohya_ss\kohya_gui.py", line 4, in <module> from dreambooth_gui import dreambooth_tab File "D:\kohya_ss\dreambooth_gui.py", line 13, in <module> from library.common_gui import ( File "D:\kohya_ss\library\common_gui.py", line 1, in <module> from tkinter import filedialog, Tk ModuleNotFoundError: No module named 'tkinter'
Author   cshadd
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-fix-modulenotfounderror-no-module-named-tkinter
How to Fix: ModuleNotFoundError: No module named 'tkinter' - GeeksforGeeks
July 23, 2025 - If the module is not installed, the interpreter will raise the “ModuleNotFoundError.” ... Another reason for the error might be a typo or incorrect naming when trying to import the tkinter module.
🌐
Super User
superuser.com › questions › 1470342 › how-do-i-resolve-the-modulenotfounderror-no-module-name-tkinter-for-window
python3 - How do I resolve the (ModuleNotFoundError: No module name '_tkinter') for WINDOWS 10, Python 3.7 - Super User
August 12, 2019 - Windows 10 Python 3.7.4 OSGeo4W Shell C:\ActiveTcl\bin is in the PATH tkinter folder is located in C:/OSGeo4W64/apps/Python37/lib/tkinter python test_data_analysis.py Traceback (most recent cal...
🌐
GitHub
github.com › pypa › pipenv › issues › 4712
"ModuleNotFoundError: No module named 'tkinter'" in Windows 10 · Issue #4712 · pypa/pipenv
June 1, 2021 - Issue description I'm Windows 10 user. It seems that tkinter is not in pipenv virtual environment. I ran this command in command prompt in windows terminal. > pipenv install > pipenv shell (.venv) >python -c "import tkinter" Expected res...
Author   2lu3
🌐
Reddit
reddit.com › r/learnpython › no module named ‘tkinter’
No module named 'tkinter' : r/learnpython
November 13, 2022 -

Hey guys

I am working in Visual Studio on a school assignment for my Computer Science class. It requires use of the turtle module. I am being told that it comes with python when you install it, however, when I try to use it, I am told that there is no module named ‘tkinter’. Could someone let me know what has to be done to fix this? Thanks

🌐
sebhastian
sebhastian.com › python-no-module-named-tkinter
ImportError: No module named _tkinter, please install the python-tk package | sebhastian
January 31, 2023 - But if you see this error on Windows, then try installing the tk package with pip: ... If that doesn’t work, run Python .exe installer and select the Modify menu. You need to make sure that the tcl/tk feature is selected as follows: ... Finish ...
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › troubleshooting
import tkinter as tkinter ImportError: No module named tkinter - Raspberry Pi Forums
When I try this there are no errors but my window doesn't open either. Thanks for the heads up on the x forwarding! Got that up and running. ... Wed Feb 26, 2020 6:48 pm What happens if you open a Terminal, go to the directory where your script is, and enter ... python3 -m tkinter - should open a test window on your desktop This works great on the pi desktop but from my remote station the window opens then immediately disappears so I cant quit out
Top answer
1 of 3
4

Ok. First off:

What you shouldn't do:

In production, if you are not sure whether a module is called one way or another (which might be depending on the Python version that is installed), you should not put all the imports together like that, because if one fails it will raise an import error and that will crash your runtime. Do the following:

try:
    import Tkinter

except ImportError:  # Python 3.x present
    import tkinter

However in your case you already know that you have Python 3 so that is not a problem. Just use the correct one (keep reading to the next section).

What it is recommendable that you do:

If you are using Python 2.x:

Module is named Tkinter. You can do from Tkinter import * and Tk will be imported.

If you are using Python 3.x:

Module is named tkinter. Note lowercase. You have to do import tkinter; and use tkinter.Tk

Rationale

You might want to read this fragment from this answer already posted on SO:

However, PEP8 has this to say about wildcard imports:

Wildcard imports ( from import * ) should be avoided

In spite of countless tutorials that ignore PEP8, the PEP8-compliant way to import would be something like this:

import tkinter as tk

When importing in this way, you need to prefix all tkinter commands with tk. (eg: root = tk.Tk(), etc). This will make your code easier to understand at the expense of a tiny bit more typing. Given that both tkinter and ttk are often used together and import classes with the same name, this is a Good Thing. As the Zen of python states: "explicit is better than implicit".

Note: The as tk part is optional, but lets you do a little less typing: tk.Button(...) vs tkinter.Button(...)

Full answer: https://stackoverflow.com/a/11621141/4396006

Why your interpreter does not import Tk

I am uncertain on why your interpreter does not import Tk for that usage. You have to provide more details to be able to solve that part of your problem.

Edit: the line from tkinter import * includes the namespace of the __init__.py file in the tkinter module folder into your file. Therefore you should check:

  1. Where is PyCharm importing the tkinter module from. You can go to the tkinter word in your import, get the contextual menu with the right click, and go to: Go to --> Declaration (or just hit Ctrl+B). It should take you to that __init__.py file where Tk should be a class defined in there.

  2. Whether your Python Path when you run the file is fetching that folder you found the Tk module in.

If any of this is not ok, then it's probably because your installation is broken. I'd be helpful if you told us if only from tkinter import * does not work or if import tkinter; tkinter.Tk is not defined either. You should go for a clean install.

To help us know the root of the problem, try to run the same code from the terminal or in the Python's console and see what happens.

2 of 3
1

Lets clear up some basics as it appears you think several things should work that never will.

No mater how you import you will always need to do Tk() with an upper case T by itself or with the appropriate prefix.

Things you have tried that will never work.

root = tk(), Tk.tk(), root = TK.TK()

all lower case tk() or all uppercase TK() will never work in tkinter.

If from tkinter import * doesn't work and doing top = tkinter.Tk() doesn't work it is very likely that you do not have tkinter installed. Or at least it has been removed for some reason.

Windows distro should come with tkinter already. I would try to do a clean install and see what happens. You should update to 3.6 anyway as 3.5 has some bugs that needed to be fixed.

As for your import issue.

from tkinter import * This line should work fine with top = Tk(). So that tells me tkinter is not installed.

import tkinter This redundant line should work as top = tkinter.Tk() but if the previous is not working then this likely wont either.

After doing some testing on PyCharm I can say that if PyCharm failed to load tkinter then it would have errored out first on the import and not the Tk() portion.

Traceback (most recent call last):
  File "C:/Users/mcdomi3/PycharmProjects/MintyFlakes/test.py", line 1, in <module>
    from Tkinter import *
ModuleNotFoundError: No module named 'tkinter'

Process finished with exit code 1

With that little revaluation I think your install is corrupt.

Conclusion.

You need to reinstall python or try to pip install tkinter as it is missing from your libraries or corrupt somehow.

🌐
Snapcraft
forum.snapcraft.io › t › modulenotfounderror-no-module-named-tkinter › 28707
ModuleNotFoundError: No module named 'tkinter' - snapcraft - snapcraft.io
February 11, 2022 - Hi Everyone, I am a novice developer and I am currently developing a python tkinter snap which which displays number on the tkinter window using core18 as base. I referred to the below topic on the forum and the window appeared as expected for core 18 as base on Ubuntu 18.04: Tkinter doesn’t work with the python plugin When I try to change the base to core20 , the snap builds and installs without any errors on my Ubuntu 20.04 machine.
🌐
Edureka Community
edureka.co › community › 54645 › python-error-importerror-no-module-named-tkinter
Python error ImportError No module named tkinter
Host '172.31.27.232' is blocked because of many connection errors; unblock with 'mariadb-admin flush-hosts'