Installation

pytktable requires Python >= 3.11 with tkinter, Python’s interface to Tcl/Tk.

Without prebuilt Tktable

Install only the Python wrapper, and Tktable yourself, if:

  • your platform is not in the list above (e.g. 32-bit ARM Linux, FreeBSD);

  • you prefer the Tktable of your OS’s package manager;

  • the prebuilt Tktable doesn’t work for you (please report it).

pip install pytktable

Then install these, which pip install pytktable does not install:

  1. Tcl and Tk, and tkinter;

  2. Tktable. It usually does not come with Tk.

How to install them depends on your OS:

Check the installation

python -m tktable

This prints the versions of Python, Tcl and Tk, where Tcl looks for extensions (auto_path), and whether Tktable can be found and loaded. It exits with status 0 on success. See python -m tktable for details.

Tktable in a non-standard location

If Tktable is installed in a directory Tcl does not search, set the environment variable TKTABLE_LIBRARY to the directory containing Tktable’s pkgIndex.tcl. That directory is named after Tktable’s version, e.g. Tktable2.10 for Tktable 2.10. See your OS page for how to set it.

Troubleshooting

_tkinter.TclError: can't find package Tktable or invalid command name "table"

Tcl cannot find Tktable. Install pytktable with prebuilt Tktable, or install Tktable and, if needed, set TKTABLE_LIBRARY. Table raises CannotUseError in this case.

ModuleNotFoundError: No module named 'tkinter'

tkinter is not installed for your Python. On Linux, install your distribution’s tkinter package (see above).

Tktable is found but fails to load

It was probably built for a different Tcl/Tk version than the one your Python uses (e.g. Tcl 8.6 vs 9.0). python -m tktable shows both.