Arnar Flatberg | 16 Jul 10:10

Ipython-matplotlib thread issue

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?

I have tried to reload matplolib and pylab, but that was obviously not a remedy. To me, the only solution was to restart ipython which is a major pain.
Is there perhaps some other way around?
Can I restart a pylab thread interactively ?

Thanks,
Arnar
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Arnar Flatberg | 16 Jul 14:15

Re: Ipython-matplotlib thread issue



On Wed, Jul 16, 2008 at 10:11 AM, Arnar Flatberg <arnar.flatberg <at> 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?

I have tried to reload matplolib and pylab, but that was obviously not a remedy. To me, the only solution was to restart ipython which is a major pain.
Is there perhaps some other way around?
Can I restart a pylab thread interactively ?

Thanks,
Arnar

I forgot to mention, this is ipython build without parallel support (no zope, Twisted, Foolscap or OpenSSL installed)
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Fernando Perez | 17 Jul 02:12

Re: Ipython-matplotlib thread issue

On Wed, Jul 16, 2008 at 1:11 AM, Arnar Flatberg
<arnar.flatberg <at> 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
Arnar Flatberg | 17 Jul 09:13

Re: Ipython-matplotlib thread issue



On Thu, Jul 17, 2008 at 2:12 AM, Fernando Perez <fperez.net <at> gmail.com> wrote:
On Wed, Jul 16, 2008 at 1:11 AM, Arnar Flatberg
> 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.

Hope this may help,

Arnar
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Fernando Perez | 17 Jul 09:41

Re: Ipython-matplotlib thread issue

On Thu, Jul 17, 2008 at 12:13 AM, Arnar Flatberg
<arnar.flatberg <at> gmail.com> wrote:
>
>
> On Thu, Jul 17, 2008 at 2:12 AM, Fernando Perez <fperez.net <at> gmail.com>
> wrote:
>>
>> On Wed, Jul 16, 2008 at 1:11 AM, Arnar Flatberg
>> <arnar.flatberg <at> 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
Arnar Flatberg | 17 Jul 10:15

Re: Ipython-matplotlib thread issue



On Thu, Jul 17, 2008 at 9:41 AM, Fernando Perez <fperez.net <at> gmail.com> wrote:
On Thu, Jul 17, 2008 at 12:13 AM, Arnar Flatberg
<arnar.flatberg <at> gmail.com> wrote:
>
>
> On Thu, Jul 17, 2008 at 2:12 AM, Fernando Perez <fperez.net <at> gmail.com>
> wrote:
>>
>> On Wed, Jul 16, 2008 at 1:11 AM, Arnar Flatberg
>> <arnar.flatberg <at> 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

I've changed the timeout to 10 s, I'll let you know if it plays out well.

Thanks,
Arnar
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user
Ville M. Vainio | 17 Jul 16:14
Gravatar

Re: Ipython-matplotlib thread issue

On Thu, Jul 17, 2008 at 10:41 AM, Fernando Perez <fperez.net <at> gmail.com> wrote:

> 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

Unfortunately it won't help - it shouldn't matter how long the
operations themselves will take. This timeout is only for the GUI
thread to *receive* the command. The cause probably is that the GUI
thread has hanged, or stopped calling runcode for some reason. It was
probably caused by something you called earlier - the command that you
entered immediately before the hang doesn't matter, because it never
got to gui thread and was never executed.

What you need to do is to inspect the state of the gui thread (you
have a live ipython session there, after all) and find out why it's
hanging.

The good news here is that you *do* get this message, and IPython
stays operational. In the old system, IPython would've just hung. If
you have valuable data, you can %store it and continue work in new
ipython session (until the probably bug in matplotlib gets fixed).

Perhaps you could get by with tk backend?

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Ville M. Vainio | 17 Jul 16:15
Gravatar

Re: Ipython-matplotlib thread issue

On Thu, Jul 17, 2008 at 5:14 PM, Ville M. Vainio <vivainio <at> gmail.com> wrote:

> ipython session (until the probably bug in matplotlib gets fixed).

"probable", of course.

--

-- 
Ville M. Vainio - vivainio.googlepages.com
blog=360.yahoo.com/villevainio - g[mail | talk]='vivainio'
Arnar Flatberg | 17 Jul 16:35

Re: Ipython-matplotlib thread issue



On Thu, Jul 17, 2008 at 4:14 PM, Ville M. Vainio <vivainio <at> gmail.com> wrote:
On Thu, Jul 17, 2008 at 10:41 AM, Fernando Perez <fperez.net <at> gmail.com> wrote:


Perhaps you could get by with tk backend?

I most certainly can. Pretty output is vital, pretty gui not so much :-)

If this works fine, I'll leave the issue with no further investigation. I am sorry, but I just dont have the know-how or time to track down the real problem.

Thanks ,

Arnar
_______________________________________________
IPython-user mailing list
IPython-user <at> scipy.org
http://lists.ipython.scipy.org/mailman/listinfo/ipython-user

Gmane