Opened 11 years ago
Last modified 18 months ago
#42191 new defect
python*: IDLE requires py*-tkinter
Reported by: | LenoreHorner | Owned by: | jyrkiwahlstedt |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.2.1 |
Keywords: | Cc: | jaroel (Roel Bruggink), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), erickt@…, cooljeanius (Eric Gallager), 1-61803, chrstphrchvz (Christopher Chavez) | |
Port: | python26 python27 python32 python33 python34 python35 python36 python37 |
Description
OS X 10.9.1 Macports 2.2.1 Xcode 5.0.2
IDLE requires py27-tkinter
/Applications/MacPorts/Python\ 2.7/IDLE.app/Contents/MacOS/IDLE ; exit; Traceback (most recent call last): File "/Applications/MacPorts/Python 2.7/IDLE.app/Contents/Resources/idlemain.py", line 71, in <module> from idlelib import macosxSupport File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/idlelib/macosxSupport.py", line 6, in <module> import Tkinter File "/opt/local/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: No module named _tkinter logout
BUT py27-tkinter requires python27
port info py27-tkinter py27-tkinter @2.7.6 (python, graphics) Variants: universal Description: Python bindings to the Tk widget set Homepage: http://docs.python.org/release/2.7.6/library/tkinter.html Extract Dependencies: xz Library Dependencies: python27, tk Platforms: darwin License: PSF Maintainers: jwa@macports.org, openmaintainer@macports.org
I think this means IDLE needs to be split out as a separate port so that one installs python27, then py-tkinter, then IDLE
Change History (12)
comment:1 Changed 11 years ago by larryv (Lawrence Velázquez)
Cc: | roel@… mcalhoun@… erickt@… added; jwa@… removed |
---|---|
Keywords: | missing tkinter dependency removed |
Owner: | changed from macports-tickets@… to jwa@… |
Port: | python24 python25 python26 python31 python32 python33 python34 added |
Summary: | python27 @ 2.7.6 IDLE fails to run → python*: IDLE requires py*-tkinter |
comment:2 Changed 11 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to LenoreHorner@…:
I think this means IDLE needs to be split out as a separate port so that one installs python27, then py-tkinter, then IDLE
That sounds like a totally reasonable suggestion. Anyone know how to build IDLE separately from python?
comment:4 Changed 11 years ago by ned-deily (Ned Deily)
IDLE is included in the Python standard library under idlelib
, so it is found in /opt/local/Library/Frameworks/Python[...]/lib/pythonX.Y/idlelib
. It is pure Python so it is not built per se, other than the usual byte-compile optimizations during installation. There are multiple ways to invoke IDLE on OS X: 1. python3.N -m idlelib
; 2. /opt/local/bin/idleM.N
and aliases; and 3. launching IDLE.app
which is a thin shell into item 1. Upstream, we don't make it easy to optionally install IDLE, or tkinter for that matter, because neither is intended to be an optional component. That said, if you really do want to make it optional, I suppose it would be better to kill two birds with one stone: you could possibly add a dummy tkinter.py (for Py3) or Tkinter.py (for Py2) that is replaced by the pyMN-tkinter
port. Unfortunately, only raising an exception in it isn't very user friendly for people trying to launch IDLE.app
; in that case, the output of stderr
only ends up in system.log
and the user has no obvious explanation why it failed (unlike with 1 and 2 where the traceback would show up in the terminal session). So, to do it right, the dummy tkinter.py should probably in addition try to create a GUI error message, perhaps using AppleScript.
comment:5 Changed 9 years ago by chrstphrchvz (Christopher Chavez)
This is technically a duplicate of #38746, although the description and affected ports are more specific in this bug.
comment:7 Changed 5 years ago by jmroot (Joshua Root)
Port: | python35 python36 python37 added; python24 python25 python31 removed |
---|
comment:8 Changed 5 years ago by GitHubRepositoryX
Since my ticket got closed I want to point out, that even if installed py37-tkinter, "IDLE.app" won't start at all. It requires the installation of xorg-server. The use of the port "xorg-server" leads to a new issue regarding "IDLE.app". After installing xorg-server and the tkinter port when starting IDLE.app, the icon for IDLE.app will jump the whole time. Therefore I suggest to exclude the whole "IDLE.app" and "Python Launcher.app" from the python ports python27 and python37. It harms the user-experience drastically and disturbs the workflow.
I checked pkgsrc, how they handle the python packages. They exclude the mentioned ".app" (IDLE, Pyhton Launcher) by default. That makes sense to me, because the ".apps" that are getting shipped with the port from macports are unusable for the average macOS users. Nevertheless those packages are completely optional and won't change how python behaves.
The official python-installer provide by the python-foundation has the option to deselect the mentioned ".apps" as well. Both versions seems to have different xorg implementation or IDLE.app, where as the version form python.org ?does not contain xorg? or at least an not visible one. Or a different ?tkinter module that runs nattily on macOS?. (the icon wont jump all the time)
?? are just ideas not actually knowledge.
comment:9 Changed 5 years ago by chrstphrchvz (Christopher Chavez)
Cc: | chrstphrchvz added |
---|
comment:10 Changed 5 years ago by GitHubRepositoryX
I recently checked: https://github.com/macports/macports-ports/blob/master/lang/python37/files/patch-setup.py.diff#L11
# Rather than complicate the code below, detecting and building # AquaTk is a separate method. Only one Tkinter will be built on # Darwin - either AquaTk, if it is found, or X11 based Tk. - if (host_platform == 'darwin' and - self.detect_tkinter_darwin(inc_dirs, lib_dirs)): - return + self.announce("INFO: Not using Tcl/Tk", 2) + return
There is AquaTk mentioned, that make sense, so I believe I was right, they use different implementations of Tkinter namely AquaTk and the X11 based Tk. This leads to those problems, because the IDLE.app is written for AquaTk and not X11.
comment:11 Changed 5 years ago by ned-deily (Ned Deily)
There is AquaTk mentioned, that make sense, so I believe I was right, they use different implementations of Tkinter namely AquaTk and the X11 based Tk. This leads to those problems, because the IDLE.app is written for AquaTk and not X11.
No, there is only one version of IDLE and one version of Tkinter in a Python release. Tkinter links to the provided version of Tk. MacPorts supports both current variants of Tk for macOS: the old, deprecated (on macOS) X11-based Tk and the "native" AquaTk (AKA Cocoa Tk). The latter is installed with port install tk +quartz
. Both variant builds of Tk present the same ABI to Tkinter. You can actually switch between the quartz variant and the X11 variant of the tk port without touching Tkinter. I keep both variants of Tk around - one activated and the other deactivated - to do comparison testing. Both variants work for me with the current IDLEs and the current versions of macOS including Catalina.
comment:12 Changed 18 months ago by Eason0210 (Eason Huang)
Thanks Ned Deily,
With your information. I install the "native" AquaTk (AKA Cocoa Tk) with sudo port install tk +quartz
and everything working well. But it take me a long time to find here.
If someone already install tk with sudo port install tk
, make sure you uninstall it by sudo port uninstall tk
before install the AquaTk.
Presumably this applies to all of our Python ports.