python / cpython

The Python programming language
https://www.python.org
Other
62.76k stars 30.08k forks source link

can't import Tkinter / use IDLE after installing Python 2.7 on Mac OS X #53473

Closed voidspace closed 13 years ago

voidspace commented 14 years ago
BPO 9227
Nosy @ronaldoussoren, @mdickinson, @ned-deily, @voidspace

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields: ```python assignee = 'https://github.com/ronaldoussoren' closed_at = created_at = labels = ['OS-mac', 'type-crash'] title = "can't import Tkinter / use IDLE after installing Python 2.7 on Mac OS X" updated_at = user = 'https://github.com/voidspace' ``` bugs.python.org fields: ```python activity = actor = 'ronaldoussoren' assignee = 'ronaldoussoren' closed = True closed_date = closer = 'ronaldoussoren' components = ['macOS'] creation = creator = 'michael.foord' dependencies = [] files = [] hgrepos = [] issue_num = 9227 keywords = [] message_count = 14.0 messages = ['110051', '110052', '110053', '110069', '110078', '110286', '110530', '110544', '110546', '112109', '112111', '113722', '123082', '123098'] nosy_count = 7.0 nosy_names = ['ronaldoussoren', 'mark.dickinson', 'ned.deily', 'michael.foord', 'Alex.Rodriguez', 'Sarth.Calhoun', 'yandapanda'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'crash' url = 'https://bugs.python.org/issue9227' versions = ['Python 2.6', 'Python 2.7'] ```

voidspace commented 14 years ago

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:

>>> 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
voidspace commented 14 years ago

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.

voidspace commented 14 years ago

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.

ronaldoussoren commented 14 years ago

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.

voidspace commented 14 years ago

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.)

ronaldoussoren commented 14 years ago

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.

ned-deily commented 14 years ago

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.

199aa966-6a89-4417-8505-0ef94bfd2e5b commented 14 years ago

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.

ned-deily commented 14 years ago

@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.

abdfc88d-d4b4-4134-bf23-f2aef0db5734 commented 14 years ago

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?

ned-deily commented 14 years ago

@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

ned-deily commented 14 years ago

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?

a9568eb2-d336-4adc-a0f6-70022a14eb8c commented 13 years ago

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.

voidspace commented 13 years ago

Works for me too. Great!