Pip install tkinter fails, python 3.8.7, redhat 10.2.1-9

$ pip install tkinter --user
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter

$ python
Python 3.8.7 (default, Dec 22 2020, 00:00:00) 
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux

>>> import tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tkinter'

$ python -m tkinter
/usr/bin/python: No module named tkinter

What is happening?! What happened to tkinter?!

With Debian based systems (such as I use) I need to…

sudo apt-get install python3-tk

… to use Tkinter.

I’m sure you’ll know the Redhat equivalent.

1 Like

Thank you! Problem solved! I followed the advice offered by Vineet Singh in the 13 Jun 2021 stackoverflow article:

> sudo yum search tkinter 
> sudo yum install python3-tkinter.x86_64

The yum asked to upgrade three packages:

 python-unversioned-command noarch  3.8.10-1.fc32  updates   11 k
 python3                    x86_64  3.8.10-1.fc32  updates   28 k
 python3-libs               x86_64  3.8.10-1.fc32  updates  7.4 M

The upgrade took about ten seconds. I then verified the install and verified that my python Telegram bot support is intact.

Out of curiosity, I wonder why pip was able to install pyTelegramBotAPI but not tkinter.

$ pip install pyTelegramBotAPI -- # works
$ pip install tkinter --user      # fails

because there is no package called tkinter on pypi.org

tkinter is part of the standard library so it is not allowed to have a 3rd party package of the same name on pypi.

1 Like