Setuptools and Tk

I’m trying to build binaries, using setup tools, that have a dependency towards Tk and so far it fails when the code tries to initialize tkinter with the infamous :

_tkinter.TclError: Can't find a usable init.tcl in the following directories:
...

This on MacOS 10.14.6 with Python 3.7 from Homebrew (I will try later on Linux).

Side problem, I tried to manually copy init.tcl into the build binary but I can’t find where the init.tcl used by Python 3.7 is located. I tried with the init.tcl of the system Python2 install but obviously it is not compatible…

EDIT:

Homebrew tkinter installation for python3 is a bit strange and seems to confuse setuptools: there is a libtcl8.6.dylib and libtk8.6.dylib, which are detected and included by setuptools. However when manually importing tkinter in python3 shell, the Tk library included is the system one, 8.5. Also, the tkinter 8.6 lacks all the support files, including init.tcl…

Removing libtcl8.6.dylib, libtk8.6.dylib and _tkinter.so make the generated binary works, though it’s using the system Tk.

Same problem on Linux, all the .tcl files needed to bootstrap tcl/tk are missing from the built apps, and the files present on my system can not be used as I guess setuptools uses the tkinter library from manylinux1

It’s trivial to reproduce, just add :

from tkinter import Tk
r = Tk()

in the main.py any app (e.g. asteroid demo) and do a setup.py build_apps, the app will immediately crash and in output.log you will get something like :

...
    r = Tk()
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1871, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
    /usr/share/tcl8.4 /home/cosmonium/build/lib/tcl8.4 /home/cosmonium/lib/tcl8.4 /home/cosmonium/build/library /home/cosmonium/library /home/cosmonium/tcl8.4.13/library /home/tcl8.4.13/library /usr/share/tcl8.4

Looking at direct/dist/commands.py (around line 800), only TCL on Windows is supported :

    # Copy over the tcl directory.
    #TODO: get this to work on non-Windows platforms.
    if sys.platform == "win32" and platform.startswith('win'):