id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	port
31996	py-ipython: pylab tcl can't find correct tk version	marshall.perrin@…	akitada@macports.org	"I'm trying to run ipython with the TkAgg backend, and I immediately get an error upon startup about its not being able to find the correct tk version (and yet that version is indeed installed).

The key error message is `/opt/local/lib/tk8.5/tk.tcl: version conflict for package ""Tk"": have 8.5.7, need exactly 8.5.11
version conflict for package ""Tk"": have 8.5.7, need exactly 8.5.11`. This used to work perfectly on this machine with Tcl 8.5.9 & earlier but has apparently been broken during recent version upgrades?   Running wish appears to work fine (starts up with no error message), but starting ipython and trying to access any Tk widgets fails this way:

{{{

mperrin@prometheus ~ > \ipython --pylab
Python 2.7.2 (default, Nov  6 2011, 11:02:11)
Type ""copyright"", ""credits"" or ""license"" for more information.

IPython 0.11 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

Welcome to pylab, a matplotlib-based Python environment [backend: TkAgg].
For more information, type 'help(pylab)'.
[TerminalIPythonApp] Error in enabling GUI event loop integration:
---------------------------------------------------------------------------
TclError                                  Traceback (most recent call last)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/frontend/terminal/int                            eractiveshell.pyc in enable_pylab(self, gui, import_all)
    449         # Now we must activate the gui pylab wants to use, and fix %run to take

    450         # plot updates into account

--> 451         enable_gui(gui)
    452         self.magic_run = self._pylab_magic_run
    453

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/lib/inputhook.pyc in                             enable_gui(gui, app)
    342         e = ""Invalid GUI request %r, valid ones are:%s"" % (gui, guis.keys())
    343         raise ValueError(e)
--> 344     return gui_hook(app)
    345

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/lib/inputhook.pyc in                             enable_tk(self, app)
    273         if app is None:
    274             import Tkinter
--> 275             app = Tkinter.Tk()
    276             app.withdraw()
    277             self._apps[GUI_TK] = app

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.pyc in __init__(self, screen                            Name, baseName, className, useTk, sync, use)
   1683                 baseName = baseName + ext
   1684         interactive = 0
-> 1685         self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use                            )
   1686         if useTk:
   1687             self._loadtk()

TclError: Can't find a usable tk.tcl in the following directories:
    /opt/local/lib/tcl8.5/tk8.5 /opt/local/lib/tcl8.5/tk8.5/Resources/Scripts /opt/local/lib/tk8.5 /opt/local/lib/tk8                            .5/Resources/Scripts /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/lib/tk                            8.5 /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/lib/tk8.5/Resources/Scr                            ipts /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/lib/tk8.5 /opt/local/Library/Fr                            ameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/library

/opt/local/lib/tk8.5/tk.tcl: version conflict for package ""Tk"": have 8.5.7, need exactly 8.5.11
version conflict for package ""Tk"": have 8.5.7, need exactly 8.5.11
    while executing
""package require -exact Tk  8.5.11""
    (file ""/opt/local/lib/tk8.5/tk.tcl"" line 18)
    invoked from within
""source /opt/local/lib/tk8.5/tk.tcl""
    (""uplevel"" body line 1)
    invoked from within
""uplevel #0 [list source $file]""


This probably means that tk wasn't installed properly.

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyfits/__init__.py:6: UserWar                            ning: Module readline was already imported from /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/pytho                            n2.7/site-packages/IPython/utils/rlineimpl.pyc, but /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/p                            ython2.7/site-packages/readline is being added to sys.path
  import pkg_resources

In [1]:
}}}

All software versions are the current ones:

{{{
mperrin@prometheus ~ > port list tcl tk py-ipython python27
tcl                            @8.5.11         lang/tcl
tk                             @8.5.11         x11/tk
py-ipython                     @0.11           python/py-ipython
python27                       @2.7.2          lang/python27

}}}"	defect	new	Normal		ports	2.0.3				tcl, py-ipython, tk
