Hey folks,
I am trying to use Python 3 Tkinter in a devenv (v1.9.0) environment on my Nixos 25.05 host. Unfortunately when I try to import tkinter I get an error:
Python 3.13.7 (main, Aug 14 2025, 11:12:11) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import tkinter
File "/nix/store/ahf3aky3a01la5b0m4mx22bc3vb7044z-python3-3.13.7-env-env/lib/python3.13/tkinter/__init__.py", line 38, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named '_tkinter'
I have looked at some other posts in this forum that say to use python3Full but that doesn’t seem to exist any more:
error: python3Full has been removed. Bluetooth support is now enabled by default. The tkinter package is available within the package set.
Here is my very simple (for easy reproduction) devenv.nix:
{ pkgs, lib, config, inputs, ... }:
{
languages.python = {
enable = true;
package = pkgs.python3.withPackages ( ps: [ ps.tkinter ] );
};
}
Devenv is using the default rolling nixpkgs release and this is a new devenv as of today just for reproduction of this issue.
So, what am I doing wrong here?
Thanks!