asdf-python icon indicating copy to clipboard operation
asdf-python copied to clipboard

ModuleNotFoundError: No module named '_tkinter'

Open SuperSonicHub1 opened this issue 3 years ago • 1 comments

Trying to use Tkinter and got this:

Traceback (most recent call last):
  File "/home/kwilliams/Software/s1mple_img/s1mple.py", line 108, in <module>
    from tkinter import Tk, Canvas, PhotoImage
  File "/home/kwilliams/.asdf/installs/python/3.10.0/lib/python3.10/tkinter/__init__.py", line 37, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

How do I configure Tk?

SuperSonicHub1 avatar Dec 22 '21 23:12 SuperSonicHub1

Still having issues with this. Haven't been able to find good documentation surrounding compiling Python with Tkinter support. Help?

SuperSonicHub1 avatar Jan 16 '22 00:01 SuperSonicHub1

I'm also having the same problem with tkinter, I use asdf with Arch and WSL, I tried to find a solution but to no avail, so I ended up uninstalling asdf.

joaodejesus avatar Sep 16 '22 02:09 joaodejesus

I just tried with 3.8.15 and it looks like it will compile with tk support if the corresponding library is present on your system. For me, on fedora, that was tk-devel.

So what worked for me was

$ asdf uninstall python 3.8.15
$ sudo dnf install tk-devel
$ asdf install  python 3.8.15

Et voila, a python with tk (and thus tkinter) support.

exterm avatar Oct 14 '22 22:10 exterm

Thanks!

SuperSonicHub1 avatar Nov 23 '22 21:11 SuperSonicHub1

After sudo dnf install tk-devel and reinstalling, I got a new error: WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib? Running sudo dnf install sqlite-devel, uninstalling and reinstalling fixed this in Fedora 38. (leaving this here in case it helps someone)

MyApaulogies avatar Dec 08 '23 23:12 MyApaulogies