Skip to content

make dev fails on macOS with ModuleNotFoundError: No module named '_tkinter' #650

@wy-hua

Description

@wy-hua

Environment

  • macOS (Apple Silicon / arm64)
  • Python 3.12 via Homebrew
  • uv for dependency management

Steps to Reproduce

  1. Clone the repo on a fresh macOS setup
  2. Run make dev

Error

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File ".../pyclashbot/__main__.py", line 32, in <module>
    from pyclashbot.bot.worker import WorkerProcess
  ...
  File "/opt/homebrew/Cellar/python@3.12/3.12.8/Frameworks/Python.framework/Versions/3.12/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'

Root Cause

Homebrew's python@3.12 bottle is not compiled with Tcl/Tk support by default. The _tkinter C extension is distributed separately via the python-tk@3.12 formula.

Fix

brew install python-tk@3.12

After installing, make dev works correctly.

Suggestion

Consider adding a note to the README or CLAUDE.md macOS setup instructions:

brew install python-tk@3.12   # required for tkinter (GUI)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions