Help with Tkinter on OS X --- driving me insane!

  • Thread starter Edward Grefenstette
  • Start date
E

Edward Grefenstette

Any attempt to do anything with Tkinter (save import) raises the
following show-stopping error:

"Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/lib-tk/Tkinter.py", line 1645, in __init__
self._loadtk()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/lib-tk/Tkinter.py", line 1659, in _loadtk
% (_tkinter.TK_VERSION, tk_version)
RuntimeError: tk.h version (8.4) doesn't match libtk.a version (8.5)"

As you can see, I'm running the vanilla install python on OS X 10.5.7.
Does anyone know how I can fix this? Google searches have yielded
results ranging from suggestions it has been fixed (not for me) to
recommendations that the user rebuild python against a newer version
of libtk (which I have no idea how to do).

I would greatly appreciate any assistance the community can provide on
the matter.

Best,
Edward
 
P

Piet van Oostrum

Edward Grefenstette said:
EG> Any attempt to do anything with Tkinter (save import) raises the
EG> following show-stopping error:
EG> "Traceback (most recent call last):
EG> File "<stdin>", line 1, in <module>
EG> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
EG> python2.6/lib-tk/Tkinter.py", line 1645, in __init__
EG> self._loadtk()
EG> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
EG> python2.6/lib-tk/Tkinter.py", line 1659, in _loadtk
EG> % (_tkinter.TK_VERSION, tk_version)
EG> RuntimeError: tk.h version (8.4) doesn't match libtk.a version (8.5)"
EG> As you can see, I'm running the vanilla install python on OS X 10.5.7.
EG> Does anyone know how I can fix this? Google searches have yielded
EG> results ranging from suggestions it has been fixed (not for me) to
EG> recommendations that the user rebuild python against a newer version
EG> of libtk (which I have no idea how to do).
EG> I would greatly appreciate any assistance the community can provide on
EG> the matter.

Have you installed Tk version 8.5?

If so, remove it. You might also install the latest 8.4 version.
 
E

Edward Grefenstette

I thought of this. I uninstalled Tk from macports, but the same error
crops up. Evidently, Tk 8.5 remains installed somewhere else, but I
don't know where. How can I find out?

Best,
Edward
 
K

Kevin Walzer

Edward said:
I thought of this. I uninstalled Tk from macports, but the same error
crops up. Evidently, Tk 8.5 remains installed somewhere else, but I
don't know where. How can I find out?

Best,
Edward

Look in /Library/Frameworks...

Kevin Walzer
Code by Kevin
http://www.codebykevin.com
 
N

Ned Deily

I thought of this. I uninstalled Tk from macports, but the same error
crops up. Evidently, Tk 8.5 remains installed somewhere else, but I
don't know where. How can I find out?

Look in /Library/Frameworks for Tcl.framework and Tk.framework. You can
safely delete those if you don't need them. But also make sure you
update to the latest 2.6 (currently 2.6.2) python.org version; as noted,
the original 2.6 python.org release had issues with user-installed Tcl
and Tk frameworks.
 
E

Edward Grefenstette

Thanks to Kevin and Ned for the pointers.
The question is now this. Running find tells me I have tk.h in the
following locations:
===
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Tk.framework/
Versions/8.4/Headers/tk.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/tk.h
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Tk.framework/
Versions/8.4/Headers/tk.h
/Developer/SDKs/MacOSX10.5.sdk/usr/include/tk.h
/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk.h
/System/Library/Frameworks/Tk.framework/Versions/8.4/Headers/tk.h
/usr/include/tk.h
/usr/local/WordNet-3.0/include/tk/tk.h
===

This seams to entail that the Tk 8.4 framework seems to be installed
in
===
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Tk.framework/
Versions/8.4/
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Tk.framework/
Versions/8.4/Headers/tk.h
/System/Library/Frameworks/Tk.framework/Versions/8.4/Headers/tk.h
===

Whereas Tk 8.5 is installed in:
===
/Library/Frameworks/Tk.framework/Versions/8.5/
===

Which ones should I delete? Should I remove all the other tk.h files?

Sorry if these are rather dumb questions, but I really do appreciate
the help.

Best,
Edward
 
K

Kevin Walzer

Edward said:
Whereas Tk 8.5 is installed in:
===
/Library/Frameworks/Tk.framework/Versions/8.5/
===

Delete this one if you want to ensure that Python sees 8.4.
 
E

Edward Grefenstette

Bingo! Updating to Python 6.2.2 did the trick (I had 6.2). I just had
to relink the /usr/bin/python to the Current directory in /Library/
Frameworks/Python.framework/Versions/ and everything worked without
deletions etc. Thanks for your help, everyone!

Best,
Edward
 
D

Dennis Lee Bieber

/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Tk.framework/
Versions/8.4/Headers/tk.h
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/tk.h
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Tk.framework/
Versions/8.4/Headers/tk.h
/Developer/SDKs/MacOSX10.5.sdk/usr/include/tk.h
/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk.h
/System/Library/Frameworks/Tk.framework/Versions/8.4/Headers/tk.h
/usr/include/tk.h
/usr/local/WordNet-3.0/include/tk/tk.h
===

Are any of those soft (or hard) links to other locations -- for
example, could /Developer/SDKs/MacOSX10.5.sdk/usr/include/tk.h be a
soft link pointing to
/Library/Frameworks/Tk.framework/Versions/8.5/Headers/tk.h

(and could there be some environment variable or other configuration
setting that puts /Developer... into the .h search path?
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top