Devenv with Python3 Tkinter in 25.05

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!

I am having the same problem );

I can’t reproduce:

$ nix-shell --pure -p 'python3' --run 'python -c "import tkinter"'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/nix/store/vxl8pzgkkw8vdb4agzwm58imrfclmfrx-python3-3.12.11/lib/python3.12/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'
$ nix-shell --pure -p 'python3.withPackages (p: [ p.tkinter ])' --run 'python -c "import tkinter"'

Nixpkgs is at 754c685f59a7.

Ok yeah I have the same experience with the command you used; however even when switching devenv over to the nixpkgs 25.05 release from devenv rolling, my devenv environment still doesn’t work.

So I went to check out devenv and sure enough there’s an issue talking about this. Guess it’s broken in devenv… :frowning:

Yes, python3Full is deprecated. Tkinter is available as a regular package.

nix shell --experimental-features "nix-command flakes" --impure --expr 'with import <nixpkgs> {}; python3.withPackages(ps: with ps; [tkinter])'
~ $ python
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