3

I am trying to install tkinter on Redhat 7.7. I have tried every combination if "sudo yum install [whatever]" and every single time it comes up with "No package [whatever] available".

pip install tkinter
pip3 install tkinter
sudo yum install python3-tkinter
sudo yum install tkinter
sudo yum install python36-tkinter
sudo yum -y install python36u-tkinter
sudo yum -y install python36-tkinter
sudo yum install tkinter
sudo yum install python36-tkinter
sudo yum install python35-tkinter.x86_64

...etc

I have tried to find what repository I might need to enable but RedHat support is all behind a pay wall. What repository do I need to enable?

At this point I am actually considering just switching to Ubuntu as RedHat is giving me all sorts of problems.

EDIT: I tried yum search tkinter and got the following:

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription- 
manager
Repo rhel-7-workstation-rpms forced skip_if_unavailable=True due to: 
/etc/pki/entitlement/4690243650278863397-key.pem
====================== Matched:tkinter==========================
python3.x86_64 : Interpreter of the Python programming language

I already have python3 installed. I don't know if had I installed via sudo yum install python3.x86_64 vs sudo yum install python3 I would have got different results.

wvn
  • 624
  • 5
  • 12
  • 1
    Try yum search tkinter, see if anything comes up. Also, you may want to think about using Centos 7 rather than Redhat 7 if you don't want support from Redhat. Centos is made from Redhat sources. – Ian Oct 14 '19 at 17:22
  • Possible duplicate of [how to install python3-tk in centos?](https://stackoverflow.com/questions/40588444/how-to-install-python3-tk-in-centos) – stovfl Oct 14 '19 at 18:12
  • maybe first use `search` instead of `install` - ie. `pip search tkinter` ? – furas Oct 14 '19 at 18:32
  • did you check first if you can `import tkinter` in Python? Usually python is preinstalled with tkinter and maybe only Linux on server may not have it because server doesn't use X windows so it can't display also tkinter windows. On Linux Mint or Ubuntu Desktop I don't have to install tkinter but on Ubuntu Server probably I had to install `apt install python-tk` but first I had to install X windows to have GUI. – furas Oct 14 '19 at 18:36
  • @stovfl I looked at that and the accepted solution was of no help in my situation. @furas I tried that initially as I was running an application dependent on tkinter but it could not find the module. `pip search tkinter` gives some results that are tkinter-dependent packages but as I recall tkinter is not a pip package. @Ian I ran `yum search tkinter`, see edit to original. Thanks also for the Centos suggestion... may have to look into that. – wvn Oct 14 '19 at 19:37
  • Did you try adding EPEL repository and searching tkinter? – acw1668 Oct 14 '19 at 23:20

2 Answers2

5

This works for me!

sudo yum search tkinter 
sudo yum install python3-tkinter.x86_64
Vineet Singh
  • 309
  • 5
  • 12
1

Alright, so I managed to fix this to my satisfaction. What I did is outlined here. First I installed ActiveState's ActiveTcl 8.5, then rebuilt python 3.6 manually by downloading the source using the following:

$: ./configure --with-tcltk-includes='-I/opt/ActiveTcl-8.5/include' 
--with-tcltk-libs='/opt/ActiveTcl-8.5/lib/libtcl8.5.so /opt/ActiveTcl- 
8.6/lib/libtk8.5.so'

$: make

$: make install

Because I had a couple different versions of Python 3.x, I had to add the following to the .bashrc:

export PYTHONPATH=/usr/local/lib/python36.zip:/usr/local/lib/python3.6:/usr/local/lib/python3.6/lib-dynload:/usr/local/lib/python3.6/site-packages:/usr/local/lib64/python3.6/site-packages

One big issue I ran into was first manually installing Python 3.8 (which came out yesterday) for which there seems to be little support for most packages so far, so be advised. I also had a few system-specific issues with pip.

wvn
  • 624
  • 5
  • 12