classification
Title: can't import Tkinter / use IDLE after installing Python 2.7 on Mac OS X
Type: crash Stage: resolved
Components: Macintosh Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: Alex.Rodriguez, Sarth.Calhoun, mark.dickinson, michael.foord, ned.deily, ronaldoussoren, yandapanda
Priority: normal Keywords:

Created on 2010-07-11 21:31 by michael.foord, last changed 2010-12-07 14:08 by ronaldoussoren. This issue is now closed.

Messages (14)
msg110051 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-07-11 21:31
After installing Python 2.7 for Mac OS X from the Python.org binary I can't use Tkinter or IDLE.

I installed the following, on Snow Leopard:

* Python 2.7 PPC/i386/x86-64 Max OS X Installer Disk Image 


>>> import Tkinter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_tkinter.so, 2): no suitable image found.  Did find:
	/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_tkinter.so: no matching architecture in universal wrapper
msg110052 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-07-11 21:35
As a further oddity, if I run IDLE.app I get an IDLE shell (weird as from the command line Tkinter can't even be imported) - but I also get an error dialog that the subprocess can't be connected to and then IDLE shuts down.
msg110053 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-07-11 21:56
Mark Dickinson confirms the problem and offers this diagnosis:

The python.org binary links to Tcl 8.4 (which doesn't seem to have a 64-bit version).

Perhaps this means having to have a separate installer for OS X 10.6.
msg110069 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-12 05:45
Mark nails the issue: there is no 64-bit version of Tk on OSX 10.5.

I'm -1 on creating a 10.6 specific installer, two installers is confusing enough.

IDLE.app somewhat works because the Makefile makes sure it gets started using a 32-bit version of the interpreter (which is a quick workaround: 'arch -i386 python2.7' starts python in 32-bit mode an Tkinter is available there)


I can't find the specific issue right now, but did file a feature request a while back for a patch that allows us to ship copies of _tkinter linked to Tk 8.4 and Tk 8.5 while having a wrapper that loads the right one.

I am however slowly moving towards liking to ship a newer version of Tk with Python. That would have to be a minimal copy of the Tcl/Tk frameworks, and would definitely require feedback from people that actually use Tkinter.
msg110078 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-07-12 10:39
I don't particularly mind what the fix is - but at the moment users can download and install Python from a python.org installer and then have an (apparently) non functioning IDLE and Tkinter.

At the very least we should advise users to install the 32bit only binary (which presumably works - I should try it) unless they *need* the 64 bit Python. (And also let them know that installing the 64 bit version means that Tkinter / IDLE doesn't work on Snow Leopard.)
msg110286 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-07-14 14:41
I'm going to experiment with embedding a minimal version of Tk in the installer, which would both fix this issue and ensure that we use a version of Tk that is better adjusted to OSX (which should remove some other issues)

I want to do this during the europython sprint days.
msg110530 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-07-17 00:04
Note that in the interim, there is a workaround for Snow Leopard users who want to use IDLE or Tkinter: use the 32-bit-only 2.7 OS X installer ("10.3") instead.
msg110544 - (view) Author: Sarth Calhoun (Sarth.Calhoun) Date: 2010-07-17 08:49
Have the same problem. Well, tried to install the 10.3 version over my 64-bit installation and that had no effect. Not sure how to get IDLE working.
msg110546 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-07-17 09:57
@Sarth: Odd, works for me.  Using the standard GUI installer on a 64-bit-capable machine running 10.6.4, I first installed the "10.5" 2.7 metapackage and verified that both IDLE.app and /usr/local/bin/idle2.7 fail.  Then, even without manually deleting anything, I installed the "10.3" 2.7 metapackage and now both work.
msg112109 - (view) Author: Danielle Dows (yandapanda) Date: 2010-07-31 00:24
I upgraded my working python from 2.5.1 (original install) to 2.7 (for macosx10.5) and got this:
** IDLE can't import Tkinter.  Your Python may not be configured for Tk. **

I tried installing the applications, with no change. I tried the macosx10.3 version, same result. Installed the applications manually, same result. I downloaded 2.6.5 and again, same result. My next attempt will be the 2.5.5 version, but I do not expect and different result. 

I am using Leopard 10.5.8 with all software up to date. Any suggestions?
msg112111 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-07-31 00:47
@Danielle: Are you sure you are launching the correct IDLE?  In a terminal window, enter the following shell commands and report the output:

  cd /Library/Frameworks/Python.framework/Versions/2.7/
  file lib/python2.7/lib-dynload/_tkinter.so
  otool -L lib/python2.7/lib-dynload/_tkinter.so
  bin/idle2.7

That last should launch idle for 2.7.  Quit it then in the Finder try double-clicking on the IDLE in /Applications/Python 2.7
msg113722 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-08-12 23:12
For the record, after some discussion at EuroPython and on the Pythonmac-SIG mailing list (thread starting here: http://mail.python.org/pipermail/pythonmac-sig/2010-July/022467.html), the current plan is to make the "64-bit" installer variant support OS 10.6 (and above) and 2-way Intel (i386, x86_64).  That way the installer can be linked with the 10.6 Tk 8.5 which supports both 32- and 64-bit and avoids the unnecessary compilation for PPC arch.

Ronald, since it might be a while until a 2.7.1 release comes out, would it be possible to make available a new vanilla 2.7 installer to replace or supplement (this time only) the original 64-bit one?
msg123082 - (view) Author: Alex Rodriguez (Alex.Rodriguez) Date: 2010-12-02 17:31
I downloaded "python-2.7.1-macosx10.6.dmg" file and tested if Tkinter and IDLE still have same issue reported here and I did not find anymore this issue.

I was able to launch IDLE and create a Tkinter GUI. From my side we can resolve and close this issue.
msg123098 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-12-02 18:35
Works for me too. Great!
History
Date User Action Args
2010-12-07 14:08:01ronaldoussorensetstatus: open -> closed
resolution: fixed
stage: resolved
2010-12-02 18:35:27michael.foordsetmessages: + msg123098
2010-12-02 17:31:40Alex.Rodriguezsetmessages: + msg123082
2010-08-20 20:12:33terry.reedylinkissue9620 superseder
2010-08-12 23:12:07ned.deilysetmessages: + msg113722
2010-07-31 00:47:26ned.deilysetmessages: + msg112111
2010-07-31 00:24:11yandapandasetversions: + Python 2.6
nosy: + yandapanda

messages: + msg112109

type: crash
2010-07-17 09:57:14ned.deilysetmessages: + msg110546
2010-07-17 08:49:08Sarth.Calhounsetnosy: + Sarth.Calhoun
messages: + msg110544
2010-07-17 00:04:05ned.deilysetnosy: + ned.deily
messages: + msg110530
2010-07-14 14:41:07ronaldoussorensetmessages: + msg110286
2010-07-14 14:32:11Alex.Rodriguezsetnosy: + Alex.Rodriguez
2010-07-12 10:39:58michael.foordsetmessages: + msg110078
2010-07-12 05:45:18ronaldoussorensetmessages: + msg110069
2010-07-11 21:59:17mark.dickinsonsetnosy: + mark.dickinson
2010-07-11 21:56:08michael.foordsetmessages: + msg110053
2010-07-11 21:35:45michael.foordsetmessages: + msg110052
2010-07-11 21:31:42michael.foordcreate