asdf-community / asdf-python

Python plugin for the asdf version manager
https://github.com/asdf-vm/asdf
MIT License
651 stars 56 forks source link

ModuleNotFoundError: No module named '_tkinter' #121

Closed SuperSonicHub1 closed 1 year ago

SuperSonicHub1 commented 2 years ago

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 commented 2 years ago

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

joaodejesus commented 1 year ago

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.

exterm commented 1 year ago

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.

SuperSonicHub1 commented 1 year ago

Thanks!

MyApaulogies commented 8 months ago

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)

eric-burel commented 7 months ago

Hey folks, I am on Ubuntu, any idea why I would hit this issue? The proposes solutions doesn't apply to Debian

Edit: nevermind there is another issue for Ubuntu: https://github.com/asdf-community/asdf-python/issues/50