I recently got a new laptop and installed Debian 13. I added pyenv and am trying to set up 3.13, but am hitting an issue I haven’t experienced before: tkinker troubles. So first, I acknowledge Python 3.13.11 installed. But at the end of the installation I got
WARNING: The Python tkinter extension was not compiled and GUI subsystem has been detected. Missing the Tk toolkit?
Looking online, seems like this is a common problem, but so far, all the proposed solutions are the same: make sure I have the packages tk, tkdev, and libtk (in my case, I tried libtk8.6 and libtk9.0) installed, and their supporting packages. All the packages that I’ve seen listed so far were installed before I did the first install. I’ve tried a bunch of packages sets, such as https://devguide.python.org/getting-started/setup-building/#install-dependencies. Everything is installed, but I keep getting the same error.
I’m wondering if anyone has suggestions besides these packages and their dependencies. Thankfully I can continue with my work, but as tkinter is something I was hoping to try out in the near future, I’d like to figure out why I can’t install it.
I am not familiar with the error that you mentioned above tbh. However, regarding tkinter, have you attempted installing it manually via pip? In the command line, type:
pip install tk
After having done so, please verify that it is installed to your active path (where Python searches for imported libraries).
I’m able to do a pip install tk, but it still doesn’t let me import tkinter, with the error import _tkinter # If this fails your Python may not be configured for Tk
Ok, I don’t have a Linux based laptop so I may not help you with additional specific issues - someone else on the forum may, however.
Now this might be a bit unrelated but can serve as a workaround and a benefit long term. Would you be open to installing PyCharm? It is user friendly IDE editor for Python with pre-installed packages including tkinter.
I’m not a fan of the free version of Pycharm; I find it hogs a lot of memory. I use VS Code for my dev work. But I’ll give it a try. That said, I have my doubts it’ll work. If something is preventing tkinter from being set up on my machine, Pycharm won’t magically make it work. It may install something that let’s tkinter install, but it’d also be useful for me to find out what that is.
Debian, at least historically, has split the base python package into several sub-packages. tkinter is one of those packages. Attempt apt install python3-full for a “regular” install, or use python3-tk to just add tkinter to the base installation.
Debian, at least historically, has split the base python package into several sub-packages. tkinter is one of those packages. Attempt apt install python3-full for a “regular” install, or use python3-tk to just add tkinter to the base installation.
The system version installed through apt runs tkinter just fine; this is an issue when installing a new version with pyenv or any other version manager (including uv).