8

I'm running macOS Sierra 10.12.2 and am trying to get Python's IDLE to work properly with Tcl/Tk. This is the error message I'm getting when I open IDLE:

Python 2.7.13 (default, Dec 18 2016, 07:03:39) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable.
Visit http://www.python.org/download/mac/tcltk/ for current information.

Visiting the link in the error message, I read the documentation and installed Tcl/Tk version 8.5.18.0 from this source. Perhaps it is important to note that I'm running a brew install of Python 2.7.13. After I installed the DMG for 8.5.18.0, the bash terminal and Python are not recognizing the Tcl/Tk upgrade (Note that it is recognizing Tcl/Tk (8.5.9) instead of 8.5.18.0. How can I get IDLE and the upgraded python install from homebrew to recognize the upgraded Tcl/Tk 8.5.18.0? In other words, how can I resolve the warning message?

  • Apologies if I've misunderstood your question, but besides the fact you get the WARNING: The version of Tcl/Tk (8.5.9) in use may be unstable message, did you actually have any issues with using Python's IDLE to work properly with Tcl/Tk 8.5.9? – Monomeeth Jan 18 '17 at 22:37
  • It is buggy--I've had several unexpected crashes. – Borealis Jan 18 '17 at 22:41
  • Thanks. I see you're running Python 2.7.13. Is there a reason you're running that version instead of, say, Python 3.6.0 ? – Monomeeth Jan 18 '17 at 22:59
  • It's the latest version of Python 2.7 installed with brew, which I prefer over Python 3. It is also the recommended Python release to play nice with the ActiveTcl 8.5.18.0 release, according to python.org/download/mac/tcltk. – Borealis Jan 18 '17 at 23:03
5
+25

According to this Python Software Foundation page:

The Python for Mac OS X installers downloaded from this website dynamically link at runtime to Tcl/Tk macOS frameworks. The Tcl/Tk major version is determined when the installer is created and cannot be overridden. The Python 64-bit/32-bit Mac OS X installers for Python 3.6.x, 3.5.x, and 2.7.x dynamically link to Tcl/Tk 8.5 frameworks. 32-bit-only Python installers for Mac OS X dynamically link to Tcl/Tk 8.4 frameworks.

In either case, the dynamically linking occurs when tkinter (Python 3) or Tkinter (Python 2) is first imported (specifically, the internal _tkinter C extension module). By default, the macOS dynamic linker looks first in /Library/Frameworks for Tcl and Tk frameworks with the proper major version. This is the standard location for third-party or built from source frameworks, including the ActiveTcl releases. If frameworks of the proper major version are not found there, the dynamic linker looks for the same version in /System/Library/Frameworks, the location for Apple-supplied frameworks shipped with macOS. (Note, you should normally not modify or delete files in /System/Library.)

Source: Look for the How Python Chooses Which Tk Library To Use subheading on https://www.python.org/download/mac/tcltk/#activetcl-8-5-18-0

Because of this, I am 99.9% certain that now you have updated to Tcl/Tk 8.5.18.0, what you need to do is to re-install Python 2.7.13.

The reason I believe this will resolve your issue is that upon reading the info I quoted, it's clear the Tcl/Tk version used by Python is chosen during the installation process and cannot be changed without installing Python again.

| improve this answer | |
3

This solution from Stack Overflow resolved the issue:

brew tap homebrew/dupes
brew install tcl-tk
brew install python --with-tcl-tk
| improve this answer | |
  • 1
    This is no more possible as the option --with-tcl-tk disappeared. – Garini Dec 6 '18 at 14:48
3

2018 Update

System provided python/tcl-tk will always show that error.

You COULD download an updated tcl-tk and an updated python install (need to reinstall python to bind to new tcl-tk - install tcl/tk first!).

My PREFERRED method is using Homebrew.

uninstall development version of tcl-tk

brew uninstall tcl-tk --devel

install tcl-tk

brew install tcl-tk

uninstall python and python3 (tcl-tk binding happens when python is installed, so we need to re-install once we have tcl-tk installed)

brew uninstall python
brew uninstall python3

reinstall python and python 3

brew install python
brew install python3

test

brew test python
brew test python3

test IDLE ("idle" points to system installed python/tcl-tk, we'll no longer use that but might as well leave it there to prevent any future issues)

idle2
idle3
| improve this answer | |
  • Yup. It works (Catalina 10.15.4) – user9869932 Apr 18 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .