[IPython-user] Ipython-matplotlib thread issue

Fernando Perez fperez.net@gmail....
Thu Jul 17 02:41:29 CDT 2008


On Thu, Jul 17, 2008 at 12:13 AM, Arnar Flatberg
<arnar.flatberg@gmail.com> wrote:
>
>
> On Thu, Jul 17, 2008 at 2:12 AM, Fernando Perez <fperez.net@gmail.com>
> wrote:
>>
>> On Wed, Jul 16, 2008 at 1:11 AM, Arnar Flatberg
>> <arnar.flatberg@gmail.com> wrote:
>> > Hi,
>> >
>> > Interactive matplotlib shuts down on me.
>> >
>> > I'm sorry, I do not have an example to reproduce the error. I don't even
>> > have a feeling when it happens. However, better to get it reported than
>> > be
>> > quiet,right?
>> >
>> > I am using ipython from trunk (0.9.0.bzr.r1016 on python2.5, ubuntu 8.04
>> > x86) and when working interactive with matplotlib (-pylab) I have (just
>> > a
>> > couple of times) recieved the warning:
>> >
>> > Warning: Timeout for mainloop thread exceeded
>> > switching to nonthreaded mode (until mainloop wakes up again)
>> >
>> > After this warning, the matplotlib figures will no longer show or an
>> > empty
>> > figure pops up. Well, I am guessing my pylab thread got killed, right?
>>
>> Mmh, I haven't seen that.   That  warning comes from a refactoring
>> that Ville did a few months back to make the threaded code supposedly
>> more robust. I'm sure he'll be able to provide some further info.  He
>> might be able to suggest how to trigger a failure, case in which we
>> could try to fix it further.
>>
>> We'll see where this goes after feedback from Ville (or anyone else
>> who's knowledgeable on the matter).
>>
>> Regards,
>>
>> f
>
> Thanks for the response Fernando. I still cant give a reproducible example
> of failure. But the same thing happened to me yesterday, and at least I was
> paying more attention this time. I do not know if it helps but this is my
> typical scenario of mentioned problem:
>
> 1.) I have worked in the ipython shell for quite some time (4-5 hours)
> 2.) I work with fairly large datasets (500 MB - 1.5 GB), and quite a few of
> them
> 3.) I have a cocurrent R-session through rpy
>
> Now, the above mentioned warning happened after I was looking up a function
> signature (of a local python package) with `?`. There was a period of about
> 5 seconds of wait (processing, nothing happens) before the warning pops up.
> Also, ipython freezed when quiting (q), I had to kill the session myself.

Here's a suggestion:

around line 430 in IPython/Shell.py, change the '5' in:

        # first make sure the message was received, with timeout
        received_ev.wait(5)

to 10 or so.  This makes ipython wait a bit longer for the gui thread
before declaring it dead.  It's possible that with such large
datasets, certain operations are taking a bit long, or that you're
going into swap.  This might help...  But I'm shooting a bit in the
dark here, so let us know how it goes.

Cheers,


f


More information about the IPython-user mailing list