473,372 Members | 1,153 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

tcl/tk version confusion with tkinter in Python 2.6, on OS X

I'm having trouble with tkinter on a new installation of Python (2.6),
built with the framework option from source that was downloaded from
python.org. I'm running OS 10.4 on a PowerPC G4.

The problem first arose when I tried to run matplotlib - it couldn't
find tcl/tk because it was searching for 8.5, and I had 8.4. I found
and built tcl/tk 8.5, which led to a new error, reproduced below:

Traceback (most recent call last):
File "brownian2.py", line 55, in <module>
main()
File "brownian2.py", line 41, in main
root = Tk()
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)

I'm a bit of a neophyte - can anyone tell me how to go about fixing
this? I've found some information by searching the list and Google,
but no helpful solutions.

Thanks,
Nat
Oct 6 '08 #1
4 4944
On Oct 6, 4:48*pm, njwilso...@gmail.com wrote:
I'm having trouble with tkinter on a new installation of Python (2.6),
built with the framework option from source that was downloaded from
python.org. I'm running OS 10.4 on a PowerPC G4.

The problem first arose when I tried to run matplotlib - it couldn't
find tcl/tk because it was searching for 8.5, and I had 8.4. I found
and built tcl/tk 8.5, which led to a new error, reproduced below:

Traceback (most recent call last):
* File "brownian2.py", line 55, in <module>
* * main()
* File "brownian2.py", line 41, in main
* * root = Tk()
* 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)

I'm a bit of a neophyte - can anyone tell me how to go about fixing
this? I've found some information by searching the list and Google,
but no helpful solutions.

Thanks,
Nat

I haven't yet installed Python 2.6, but I've seen this error reported
here and on the MacPython list.

Based on what I'm seeing in the error message and in the setup.py file
in the source code, it appears that Python 2.6 is looking in
/System/Library/Frameworks for a Tcl/Tk installation rather than in
/Library/Frameworks, which is second on the list of places to look.
Tcl/Tk 8.4 comes standard with OS X in 10.4 and 10.5, and it's
installed
in /System/Library/Frameworks. The problem is that Python 2.6 seems to
be linked against Tcl/Tk 8.5--is this correct?--and when it finds Tcl/
tk
8.4, it returns an error.

You can avoid this problem by building Python yourself and putting
/Library/Frameworks first on the search path for Tcl/Tk. Look in
setup.py 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 Python.org should do--look first in
/Library/Frameworks and then fall back on /System/Library/Frameworks.
I'm not sure why it doesn't.

Should a bug report be filed against this? If the Mac build of Python
2.6 consistently looks in /System/Library/Frameworks for Tcl/Tk, it
won't run Tkinter applications. It makes the build pretty much useless
for anyone needing it to run Tkinter apps, including Idle. I'd say
it's
a showstopper issue.

--Kevin
Oct 6 '08 #2
On Oct 6, 5:58*pm, kevin.wal...@gmail.com wrote:
On Oct 6, 4:48*pm, njwilso...@gmail.com wrote:
I'm having trouble with tkinter on a new installation of Python (2.6),
built with the framework option from source that was downloaded from
python.org. I'm running OS 10.4 on a PowerPC G4.
The problem first arose when I tried to run matplotlib - it couldn't
find tcl/tk because it was searching for 8.5, and I had 8.4. I found
and built tcl/tk 8.5, which led to a new error, reproduced below:
Traceback (most recent call last):
* File "brownian2.py", line 55, in <module>
* * main()
* File "brownian2.py", line 41, in main
* * root = Tk()
* 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)
I'm a bit of a neophyte - can anyone tell me how to go about fixing
this? I've found some information by searching the list and Google,
but no helpful solutions.
Thanks,
Nat

I haven't yet installed Python 2.6, but I've seen this error reported
here and on the MacPython list.

Based on what I'm seeing in the error message and in the setup.py file
in the source code, it appears that Python 2.6 is looking in
/System/Library/Frameworks for a Tcl/Tk installation rather than in
/Library/Frameworks, which is second on the list of places to look.
Tcl/Tk 8.4 comes standard with OS X in 10.4 and 10.5, and it's
installed
in /System/Library/Frameworks. The problem is that Python 2.6 seems to
be linked against Tcl/Tk 8.5--is this correct?--and when it finds Tcl/
tk
8.4, it returns an error.

You can avoid this problem by building Python yourself and putting
/Library/Frameworks first on the search path for Tcl/Tk. Look in
setup.py 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 Python.org should do--look first in
/Library/Frameworks and then fall back on /System/Library/Frameworks.
I'm not sure why it doesn't.

Should a bug report be filed against this? If the Mac build of Python
2.6 consistently looks in /System/Library/Frameworks for Tcl/Tk, it
won't run Tkinter applications. It makes the build pretty much useless
for anyone needing it to run Tkinter apps, including Idle. I'd say
it's
a showstopper issue.

--Kevin
Worked like a charm for getting Tkinter to work, thanks!

Seems strange that this is the way it's shipped; wonder if there's a
good reason?

Still having trouble with matplotlib, but I suspect that's unrelated,
and I'll work on it.

Again, thanks!
Oct 6 '08 #3
On Oct 6, 5:58*pm, kevin.wal...@gmail.com wrote:
On Oct 6, 4:48*pm, njwilso...@gmail.com wrote:
I'm having trouble with tkinter on a new installation of Python (2.6),
built with the framework option from source that was downloaded from
python.org. I'm running OS 10.4 on a PowerPC G4.
The problem first arose when I tried to run matplotlib - it couldn't
find tcl/tk because it was searching for 8.5, and I had 8.4.
I also had this problem. The error message at this point is
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/lib-dynload/_tkinter.so, 2): Library not loaded: /
Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/
lib/python2.6/lib-dynload/_tkinter.so
Reason: image not found

Note that at this point I did have Tk 8.4 installed at
/System/Library/Frameworks/Tk.framework/Versions/8.4
and this works fine with Python 2.5, so Python 2.6 seems to be looking
specifically for Tk 8.5.
I found
and built tcl/tk 8.5, which led to a new error, reproduced below:
RuntimeError: tk.h version (8.4) doesn't match libtk.a version (8.5)
I installed Tcl/Tk 8.5 from ActiveState and got the same error.
Based on what I'm seeing in the error message and in the setup.py file
in the source code, it appears that Python 2.6 is looking in
/System/Library/Frameworks for a Tcl/Tk installation rather than in
/Library/Frameworks, which is second on the list of places to look.
Tcl/Tk 8.4 comes standard with OS X in 10.4 and 10.5, and it's
installed
in /System/Library/Frameworks. The problem is that Python 2.6 seems to
be linked against Tcl/Tk 8.5--is this correct?--and when it finds Tcl/
tk
8.4, it returns an error.
I don't think that is quite right. In this second error, I think 8.4
is the compiled-in version, 8.5 is the version detected at runtime.
8.4 is the value of _tkinter.TK_VERSION, 8.4 is read from the Tk
object.

It looks to me like Python 2.6 is built against Tcl/tk 8.4 but at
runtime it looks for Tcl/tk 8.5.
Should a bug report be filed against this? If the Mac build of Python
2.6 consistently looks in /System/Library/Frameworks for Tcl/Tk, it
won't run Tkinter applications. It makes the build pretty much useless
for anyone needing it to run Tkinter apps, including Idle. I'd say
it's
a showstopper issue.
I think so.

Kent
Oct 7 '08 #4
There is already a bug report concerning this matter: http://bugs.python.org/issue4017
Nov 1 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: srijit | last post by:
Hello, Any idea - why the following code crashes on my Win 98 machine with Python 2.3? Everytime I run this code, I have to reboot my machine. I also have Win32all-157 installed. from Tkinter...
2
by: pipehappy | last post by:
I am a newbie to the Python and wonder how I can know version of tk bound with Python Can some one tell me? Thanks
1
by: John Chambers | last post by:
Sp my latest adventure is attempting to use python's Tkinter module on a few machines. On my PB (OSX 10.3.9), I got the following confusing results: /Users/jc: python Python 2.3 (#1, Sep 13...
0
by: jwoolard | last post by:
Version 0.7 of Crunchy has been released. It is available on Sourceforge (http://sourceforge.net/project/showfiles.php?group_id=169458) Crunchy, the Interactive Python Tutorial Maker, is an...
5
by: Ben Kovitz | last post by:
Hi, I just tried to run Tkinter on OS X 10.3.9 under Python 2.4.3, and I'm getting a bus error as soon as I call Tk(). Googling has turned up info other Tkinter bus errors, but not this one that...
32
by: Kevin Walzer | last post by:
I'm a Tcl/Tk developer who has been working, slowly, at learning Python, in part because Python has better support for certain kinds of applications that I want to develop than Tcl/Tk does....
4
by: MartinRinehart | last post by:
Everything I've read about Tkinter says you create your window and then call its mainloop() method. But that's not really true. This is enough to launch a default window from the console: ...
13
by: Daniel Fetchinson | last post by:
Was looking at PEP 3108, http://www.python.org/dev/peps/pep-3108/ , Is it just me or others also think that it would be a major loss to remove tkinter from the python core? PEP 3108 starts off...
8
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.