Troubleshooting¶
_tkinter.TclError: can't find package Tktableorinvalid command name "table"Tcl cannot find Tktable. Install pytktable with prebuilt Tktable, or install Tktable and, if needed, set TKTABLE_LIBRARY.
TableraisesCannotUseErrorin this case.ModuleNotFoundError: No module named 'tkinter'tkinter is not installed for your Python. On Linux, install your distribution’s tkinter package (see the commands).
ImportError: ... Library not loaded: .../libtk8.6.dylibon macOSYour Python was compiled (e.g. by pyenv) against Homebrew’s Tcl/Tk 8.6, which Homebrew has since replaced with Tcl/Tk 9 in the
tcl-tkformula. Python 3.14 and newer work with Tcl/Tk 9, so reinstalling them is enough. Python 3.11 to 3.13 need Tcl/Tk 8.6, from Homebrew’stcl-tk@8; with pyenv, e.g. for Python 3.11.9:brew install tcl-tk@8
pyenv uninstall -f 3.11.9
PKG_CONFIG_PATH="$(brew --prefix tcl-tk@8)/lib/pkgconfig" pyenv install 3.11.9
Then check tkinter again, and recreate your virtual environments. The python.org installers for macOS don’t have this problem: they come with their own Tcl/Tk.
- 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 tktableshows both.