Title: Tkinter cannot find Tcl/Tk on Mac OS X
Type: crash Stage:
Components: Build, Installation, Macintosh, Tkinter Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: TJ, Watchman, andreb, beazley, benjamin.peterson, donbraffitt, fzero, keflavich, kjohnson, malkarouri, mtsch, naufraghi, ned.deily, ohmi, reowen, ronaldoussoren, tommusic, wordtech
Priority: normal Keywords:

Created on 2008-10-02 15:16 by fzero, last changed 2009-07-08 06:15 by ronaldoussoren. This issue is now closed.

Messages (27)
msg74166 - (view) Author: Fabio FZero (fzero) Date: 2008-10-02 15:16
I've just installed Python 2.6 on Mac OS X 10.5.5 and IDLE won't start.
IDLE 2.5 still works fine.

Here's the traceback:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/Current/bin/idle",
line 3, in <module>
    from idlelib.PyShell import main
line 14, in <module>
    import macosxSupport
line 6, in <module>
    import Tkinter
line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
  Referenced from:
  Reason: image not found
msg74221 - (view) Author: Ohmi (ohmi) Date: 2008-10-03 00:57
Installing tcl 8.5 from activestate gets rid of that error but then the 
following happens on my pretty clean iMac:

Traceback (most recent call last):
  File "/usr/local/bin/idle", line 5, in <module>
/", line 1382, in main
    root = Tk(className="Idle")
tk/", line 1645, in __init__
tk/", line 1659, in _loadtk
    % (_tkinter.TK_VERSION, tk_version)
RuntimeError: tk.h version (8.4) doesn't match libtk.a version (8.5)
msg74341 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-10-05 12:40
I suspect this is my fault for linking the libraries incorrectly as I
built the installer.
msg74342 - (view) Author: Miki Tebeka (tebeka) * Date: 2008-10-05 12:46
FWIW, installing MacPorts tcl and tk (8.5.4) didn't help
msg74440 - (view) Author: Nat (njw23) Date: 2008-10-07 12:18
I asked a slightly different question (related to tkinter in general on
OS 10.4.11), but the symptoms were remarkably similar - perhaps the
solution is as well?

Worth a try?
msg74544 - (view) Author: Leo M (leoofborg) Date: 2008-10-08 19:25
Hello. First time here, beginner at Python. I have verified that the
Google tip link in the previous to fix IDLE works for me. Post in question:

[Kevin's post of 6.Oct, 02:58]
You can avoid this problem by building Python yourself and putting
/Library/Frameworks first on the search path for Tcl/Tk. Look in in the source code, around line  1438 (in the
'detect_tkinter_darwin' function), and either comment out
/System/Library or put it underneath /Library/Frameworks. This is what
the official build from should do--look first in
/Library/Frameworks and then fall back on /System/Library/Frameworks.
I'm not sure why it doesn't.


In, I simply put /Library/Frameworks/ first as outlined above,
and then did a config-make-install of the Framework version of Python.
IDLE now does not silently fail now, but runs as 'expected'.

-Leo Marihart
 Python Newb, 
 Somewhat more experienced shell guy
msg74663 - (view) Author: Matteo Bertini (naufraghi) Date: 2008-10-12 11:02
I have the same error as in msg74221
RuntimeError: tk.h version (8.4) doesn't match libtk.a version (8.5)

Some workaround not involving a full rebuild?
msg74722 - (view) Author: Joachim Strombergson (Watchman) Date: 2008-10-14 07:09

I followed the suggestions in msg74544 by Leo M and can confirm that
IDLE starts as OK.

*BUT* when I try to import Tkinter I get:

>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
  Referenced from:

It seems the fix is not 100%
msg74764 - (view) Author: Don Braffitt (donbraffitt) Date: 2008-10-14 18:47
>I've just installed Python 2.6 on Mac OS X 10.5.5 and IDLE won't start.

I have the same problem with Python 2.6 IDLE on Mac OS X 10.4.11.
msg74765 - (view) Author: Nat (njw23) Date: 2008-10-14 18:55
If you look in /Library/Frameworks/Tcl.framework/Versions/, what's
there? How about in /Library/Frameworks/Tcl.framework/Versions/8.5/?
msg74838 - (view) Author: Don Braffitt (donbraffitt) Date: 2008-10-16 16:59
ITEC-MBP-15087:~ dbraffitt$ cd /Library/Frameworks/Tcl.framework/         
-bash: cd: /Library/Frameworks/Tcl.framework/: No such file or directory

- Don
msg74840 - (view) Author: Nat (njw23) Date: 2008-10-16 17:23
Do you know if you have tcl/tk somewhere else? Otherwise, I think you
need to install it. You can get the source from Sourceforge, or I think
you can get it from Activestate.
msg74893 - (view) Author: Mark Tsuchida (mtsch) Date: 2008-10-17 03:30
There are two symptoms here, each caused by a different bug.
Neither is specific to IDLE; they have to do with Tkinter recognizing 
the correct Tcl/Tk installation at build time and run time.

Bug 1: The Python 2.6 binary installer appears (judging from the error 
message) to have been built against a Tcl installation in 
/Library/Frameworks/Tcl.framework. Mac OS X (10.4.11 and I assume 
Leopard as well) comes with Tcl/Tk, installed in 
/System/Library/Frameworks, but there will be no 
/Library/Frameworks/Tcl.framework unless you install Tcl/Tk on your own 
(but read on before doing so).

Symptom 1: Hence, the error about not being able to find 
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl. This symptom should 
not manifest if either a) you install Tcl/Tk 8.5 on your own, or b) you 
build Python from the source (so that it finds the pre-installed Tcl in 

Bug 2: The Python source distribution (both 2.5.2 and 2.6; I have not 
checked earlier versions) searches for Tcl and Tk in the wrong order, as 
pointed out in the comp.lang.python post referenced in msg74440 and 

In Mac OS X's standard search order for frameworks, /Library/Frameworks 
comes before /System/Library/Frameworks (see the ld and dyld man pages:
ld.1.html and
dyld.1.html), whereas the script in the Python source 
distribution tries /System/Library/Frameworks/Tcl.framework before 
/Library/Frameworks/Tcl.framework (and same for Tk.framework).

Symptom 2: This causes a problem _only_ when you have a separately 
installed version of Tcl (e.g. 8.5).
Python's script finds the Tk installation in 
/System/Library/Frameworks/Tk.framework (version 8.4) and uses its 
headers, whereas the linker (being part of Mac OS X) chooses the Tk 
dynamic library in /Library/Frameworks/Tk.framework (version 8.5 if 
that's what you installed). (I suspect the linker records the Tcl and Tk 
installations (or versions) found at build time.) Hence the error 
message about Tk version mismatch.

If you are affected by both of these bugs, Tkinter will not work whether 
or not you install Tcl 8.5 in /Library/Frameworks.

I believe the script ought to be corrected (as per the post 
cited in msg74544). I do not know of an easy fix for existing Python 
installations that are affected by this, other than rebuilding Python.
msg74981 - (view) Author: Andre Berg (andreb) Date: 2008-10-19 18:25
Per instructions in the helpful post outlining the Library search order,
I downloaded and installed AquaTk 8.5.4, then I downloaded
Python-2.6.tar.gz source, ran ./configure --enable-framework, sudo make
build, sudo make install.

IDLE appears to be working well so far. Also the Python interactive
interpreter appears to be working. Except that whenever I do an import
<module> I get a Bus Error and the Python interpreter crashes. 
This appears randomly, but no less than the second import <module>
statement I type one after the other. It is interesting to note that the
interactive prompt in the IDLE does not have this problem. Only the
command line (e.g. Terminal) interactive interpreter does, as well as

Following is the crash report shown by the Apple Crash Reporter.
Hopefully someone can make sense of it, as I can't (I am not a hardcore
programmer, unfortunately.)

-------------------------- CRASH REPORT ----------------------------
Parent Process:  bash [766]

Date/Time:       2008-10-19 20:11:18.643 +0200
OS Version:      Mac OS X 10.5.5 (9F33)
Report Version:  6

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread:  0

Thread 0 Crashed:
0                   	0x000bba3c call_readline + 732
1   org.python.python             	0x001d43ae PyOS_Readline + 254
2   org.python.python             	0x001d5ba0 tok_nextc + 64
3   org.python.python             	0x001d6425 PyTokenizer_Get + 101
4   org.python.python             	0x001d0da0 parsetok + 256
5   org.python.python             	0x002b0942 PyRun_InteractiveOneFlags
+ 306
6   org.python.python             	0x002b0c83 PyRun_InteractiveLoopFlags
+ 99
7   org.python.python             	0x002b1549 PyRun_AnyFileExFlags + 185
8   org.python.python             	0x002c2506 Py_Main + 3046
9         	0x00001f7b 0x1000 + 3963
10         	0x00001ea9 0x1000 + 3753

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x00000000  ebx: 0x000bb76b  ecx: 0xbfffeff8  edx: 0x00417ea0
  edi: 0x004291d0  esi: 0x004256d0  ebp: 0xbffff108  esp: 0xbffff020
   ss: 0x0000001f  efl: 0x00010246  eip: 0x000bba3c   cs: 0x00000017
   ds: 0x0000001f   es: 0x0000001f   fs: 0x00000000   gs: 0x00000037
  cr2: 0x00000000

Binary Images:
    0x1000 -     0x1ff5 2.6 (2.6)
   0x48000 -    0x48ffc ??? (???)
   0xba000 -    0xbbff1 ??? (???)
   0xc1000 -    0xd7fea  libedit.2.dylib ??? (???)
<be5a6f391887bb96bdeeafd443cf19fb> /usr/lib/libedit.2.dylib
   0xe2000 -    0xe5ff3 ??? (???)
   0xeb000 -    0xeefff ??? (???)
   0xf5000 -    0xf6fff ??? (???)
  0x1cf000 -   0x2f5fe3 +org.python.python 2.6.0, (c) 2004-2008 Python
Software Foundation. (2.6.0) <44f73bce7c729a42509bd1761feecc32>
0x8fe00000 - 0x8fe2da53  dyld 96.2 (???)
<7af47d3b00b2268947563c7fa8c59a07> /usr/lib/dyld
0x92778000 - 0x9277ffe9  libgcc_s.1.dylib ??? (???)
<a9ab135a5f81f6e345527df87f51bfc9> /usr/lib/libgcc_s.1.dylib
0x94583000 - 0x94587fff  libmathCommon.A.dylib ??? (???)
0x94a36000 - 0x94b96ff3  libSystem.B.dylib ??? (???)
<a12f397abf2285077b89bd726bff5b18> /usr/lib/libSystem.B.dylib
0x95526000 - 0x95555ff7  libncurses.5.4.dylib ??? (???)
<3b2ac2ca8190942b6b81d2a7012ea859> /usr/lib/libncurses.5.4.dylib
0xffff0000 - 0xffff1780  libSystem.B.dylib ??? (???)


I have MacPorts installed and also an old Fink installation. Could this
be causing it? I also looked through the README troubleshooting section,
and I did not change the default installation location for the framework
as suggested in the README.

If someone could help I'd be most grateful.

msg75148 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-10-23 20:24
Assigning to Ronald. I all that needs to be done, it have the installers
built correctly.
msg76047 - (view) Author: TJ Usiyan (TJ) Date: 2008-11-19 13:43
same here
msg76101 - (view) Author: David M. Beazley (beazley) Date: 2008-11-20 13:25
Just a quick comment from the Python training universe--this bug makes it 
impossible to use Python 2.6 in any kind of Python teaching environment 
where IDLE tends to be used a lot.  I'm having to tell students to stick 
with Python-2.5.2.
msg77016 - (view) Author: Muhammad Alkarouri (malkarouri) Date: 2008-12-05 13:50
Now that Python 2.6.1 is out, can we expect a new OS X installer built
correctly? I think this is pretty important..
msg78034 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-12-18 17:40
I've uploaded a .dmg for 2.6.1 to Could you please test it?
msg78036 - (view) Author: Joachim Strombergson (Watchman) Date: 2008-12-18 18:08
I downloaded the newly built 2.6.1 dmg and can confirm that, at least
for me:

(1) import Tkinter works.
(2) Starting IDLE works.

It looks like we have a winner, good job Benjamin!
msg78051 - (view) Author: Don Braffitt (donbraffitt) Date: 2008-12-19 01:19
>I've uploaded a .dmg for 2.6.1 to
> Could you please test it?

I installed the 2.6.1 .dmg on Mac OS X 10.5.5, and IDLE once again works

- Don
msg78068 - (view) Author: Muhammad Alkarouri (malkarouri) Date: 2008-12-19 18:57
2008/12/18 Benjamin Peterson <>:
> Benjamin Peterson <> added the comment:
> I've uploaded a .dmg for 2.6.1 to
> Could you please test it?

Just to confirm, I have installed the package in OS X 10.4.11, and
Tkinter and Idle work fine.

Many Thanks.
msg78077 - (view) Author: Ohmi (ohmi) Date: 2008-12-19 23:38
Installed on 10.5.6, IDLE ran correctly.
Nicely done.
msg78129 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-12-20 22:06
Ok. Thanks for testing! I've added the installers to the website.
msg90091 - (view) Author: Adam Ginsburg (keflavich) Date: 2009-07-03 23:43
Although this is an old & closed error, I'm still running in to it.

I am trying to compile & install 64 bit python with Tk/Tcl support on
Mac OS X 10.5.7.

I have installed 64-bit Tcl/Tk:
$ file /Library/Frameworks/Tk.framework/Versions/8.5/Tk
/Library/Frameworks/Tk.framework/Versions/8.5/Tk: Mach-O universal
binary with 3 architectures
/Library/Frameworks/Tk.framework/Versions/8.5/Tk (for architecture
ppc7400):    Mach-O dynamically linked shared library ppc
/Library/Frameworks/Tk.framework/Versions/8.5/Tk (for architecture
i386):       Mach-O dynamically linked shared library i386
/Library/Frameworks/Tk.framework/Versions/8.5/Tk (for architecture
x86_64):     Mach-O 64-bit dynamically linked shared library x86_64
$ file /Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl: Mach-O universal
binary with 3 architectures
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (for architecture
ppc7400):  Mach-O dynamically linked shared library ppc
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (for architecture
i386):     Mach-O dynamically linked shared library i386
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (for architecture
x86_64):   Mach-O 64-bit dynamically linked shared library x86_64

Everything that links to appears to be 64-bit capable:
$ otool -L
(compatibility version 8.5.0, current version 8.5.7)
        /Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility
version 8.5.0, current version 8.5.7)
        /usr/local/lib/libgcc_s.1.dylib (compatibility version 1.0.0,
current version 1.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.0.0)

But somehow doesn't have x86_64 support:
$ file
Mach-O universal binary with 2 architectures
(for architecture i386):        Mach-O bundle i386
(for architecture ppc7400):     Mach-O bundle ppc

How can I make tkinter work with 64 bit Tcl/Tk?
msg90249 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2009-07-08 02:31
@keflavich: To include 64-bit support for Tcl/Tk on OSX, you'll need to 
modify python's file.  Search down for
  "All existing framework builds of Tcl/Tk don't support 64-bit"
around line 1500 in 2.6; there is explicit code there to prevent tkinter 
from attempting to link with x86_64 and ppc64 libraries.
msg90251 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2009-07-08 06:15
keflavich: Please open a new issue for the problem you are running in, it 
is a completely seperate issue than the one you appended your message to.

Where can I download a 64-bit capable version of Tcl/Tk? 

BTW. The correct fix would be to add a probe to that detects if 
Tcl/Tk was build with 64-bit support or not.
Date User Action Args
2009-07-08 06:15:40ronaldoussorensetmessages: + msg90251
2009-07-08 02:31:40ned.deilysetnosy: + ned.deily
messages: + msg90249
2009-07-03 23:43:11keflavichsetnosy: + keflavich
messages: + msg90091
2008-12-20 22:06:45benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg78129
2008-12-19 23:38:17ohmisetnosy: beazley, reowen, ronaldoussoren, kjohnson, wordtech, benjamin.peterson, naufraghi, fzero, ohmi, tommusic, Watchman, donbraffitt, mtsch, andreb, TJ, malkarouri
messages: + msg78077
2008-12-19 22:01:50leoofborgsetnosy: - leoofborg
2008-12-19 21:53:42tebekasetnosy: - tebeka
2008-12-19 18:57:41malkarourisetmessages: + msg78068
2008-12-19 01:19:18donbraffittsetmessages: + msg78051
2008-12-18 18:08:59Watchmansetmessages: + msg78036
2008-12-18 17:40:23benjamin.petersonsetmessages: + msg78034
2008-12-05 13:50:06malkarourisetnosy: + malkarouri
messages: + msg77016
2008-11-20 13:25:32beazleysetnosy: + beazley
messages: + msg76101
2008-11-19 13:43:06TJsetnosy: + TJ
messages: + msg76047
2008-10-23 20:24:46benjamin.petersonsetassignee: ronaldoussoren
messages: + msg75148
nosy: + ronaldoussoren
2008-10-20 19:17:55reowensetnosy: + reowen
2008-10-19 18:25:55andrebsetnosy: + andreb
messages: + msg74981
versions: - Python 2.5
2008-10-17 23:39:42njw23setnosy: - njw23
2008-10-17 23:38:54wordtechsetnosy: + wordtech
2008-10-17 03:30:13mtschsetnosy: + mtsch
title: IDLE 2.6 broken on OSX (Leopard) -> Tkinter cannot find Tcl/Tk on Mac OS X
messages: + msg74893
components: + Build, Installation, Macintosh, Tkinter, - IDLE
versions: + Python 2.5
2008-10-16 17:23:56njw23setmessages: + msg74840
2008-10-16 16:59:43donbraffittsetmessages: + msg74838
2008-10-14 18:55:10njw23setmessages: + msg74765
2008-10-14 18:47:05donbraffittsetnosy: + donbraffitt
messages: + msg74764
2008-10-14 07:09:29Watchmansetnosy: + Watchman
messages: + msg74722
2008-10-12 11:02:13naufraghisetnosy: + naufraghi
messages: + msg74663
2008-10-08 19:25:34leoofborgsetnosy: + leoofborg
messages: + msg74544
2008-10-07 18:03:49kjohnsonsetnosy: + kjohnson
2008-10-07 12:18:21njw23setnosy: + njw23
messages: + msg74440
2008-10-05 12:46:44tebekasetmessages: + msg74342
2008-10-05 12:40:04benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg74341
2008-10-05 10:11:09tebekasetnosy: + tebeka
2008-10-03 17:52:27tommusicsetnosy: + tommusic
2008-10-03 00:57:31ohmisetnosy: + ohmi
messages: + msg74221
2008-10-02 15:16:29fzerocreate