[IPython-dev] Re: [SciPy-dev] Generic gui_thread + IPython: solution already exists!

Fernando Perez Fernando.Perez at colorado.edu
Mon Nov 15 23:13:33 EST 2004

Prabhu Ramachandran wrote:
>>>>>>"FP" == Fernando Perez <Fernando.Perez at colorado.edu> writes:
> [...]
>     FP> Quick report with this Shell.py you just sent. On a Fedora3
>     FP> box, I get with -wthread:
> [...]
>     FP> 4. I kept rotating the view, and all of a sudden python
>     FP>    coredumped. Mayavi and
>     FP> ipython both went up in smoke.  Not good.
>     FP> This is definitely not user-ready, sorry to say so :(
> Yeah, I thought as much.  I realized later that the new Shell.py was a
> late night shot-in-the-dark.
> On my debian machine, everything works nicely (no jerking, no
> crashing).  So, this is doubly frustrating.  Why doesn't everyone run
> debian? ;-)
> BTW, does this version of FC ship with threaded versions of
> libtcl/libtk/_tkinter?  If it does, I am at a loss.

Well, here's some more info:

planck[~]> ldd /usr/lib/libtk8.4.so
         libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x0031f000)
         libdl.so.2 => /lib/libdl.so.2 (0x00319000)
         libm.so.6 => /lib/tls/libm.so.6 (0x002f4000)
         libc.so.6 => /lib/tls/libc.so.6 (0x001d6000)
         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x001bd000)
planck[~]> ldd /usr/lib/libtcl8.4.so
         libdl.so.2 => /lib/libdl.so.2 (0x00319000)
         libm.so.6 => /lib/tls/libm.so.6 (0x002f4000)
         libc.so.6 => /lib/tls/libc.so.6 (0x001d6000)
         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x001bd000)
planck[~]> ldd /usr/lib/python2.3/lib-dynload/_tkinter.so
         libtix8.1.8.4.so => /usr/lib/libtix8.1.8.4.so (0x55025000)
         libtk8.4.so => /usr/lib/libtk8.4.so (0x5505f000)
         libtcl8.4.so => /usr/lib/libtcl8.4.so (0x5512c000)
         libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x551cd000)
         libpthread.so.0 => /lib/tls/libpthread.so.0 (0x55295000)
         libc.so.6 => /lib/tls/libc.so.6 (0x552a7000)
         libdl.so.2 => /lib/libdl.so.2 (0x553c3000)
         libm.so.6 => /lib/tls/libm.so.6 (0x553c8000)
         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x001bd000)

So it seems that _tkinter has thread support, but NOT tcl/tk.  Maybe that 
explains the difference with your box.  Unfortunately, I can't really offer to 
do a full separate build of tcl/tk/tkinter/python to get a fully threaded 
setup, that would take _waaaay_ more time than I can spend on this.

But it does piss me off to know that it's a stupid distribution issue!  Your 
debian success proves that it _can_ work!  Do you know of any reason why 
Fedora would do the tcl/tk builds without thread support, other than moronism?

> Anyway, I think the only way out of this mess would be to add a -tk
> flag.  I've just done that.  So you can do -{g,w}thread without -tk
> and you should see no problems.  If you have decent Tcl/Tk/tkinter
> build or a good OS ;-) then you could risk trying '-tk'.  I've made a
> patch for this and attached it below.  The code isn't the greatest but
> works for me.  So to enable Tk do `ipython -{g,w}thread -tk`.

Yes, the -tk separate flag would certainly be a necessity.  I can always fold 
this into offering -gthread AND -gthreadtk (similar for -wthread), so people 
only need to pass a single option to activate all thread/gui stuff.  I can 
unpack them inside myself.  But this will have to be strongly documented, 
since it's so easy to get a broken, segfaulting setup.

I'm seriously starting to envy debian...

Thanks again!  Do you think you'll tweak this further, or should I consider 
this last patch final?  I'm in no hurry.



More information about the IPython-dev mailing list