Quantcast

ipython prompt slows significantly after importing from mayavi

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ipython prompt slows significantly after importing from mayavi

Stefan
Hello,

I have given up to get ipython qtconsole working with mayavi on my Mac for now.

Unfortunately, it doesn't quite work on the plain ipython shell either. Most of the time, after importing anything from mayavi, e.g.

from mayavi import mlab

the ipython command prompt becomes so slow and unresponsive that it is impossible to work with. I say "most of the time", since about every fourth restart of ipython "survives" the mayavi import. If one gets lucky and gets such a "surviving" shell, it remains responsive even after subsequent mayavi commands. One could actually do some work then...  

Would be great if every "ipython" launch would predictable result in a workable environment, though.

Hence my post. Is it possible that some buffer in ipython gets almost filled up when importing a large module? Can one increase this buffer? Any other ideas how one could remedy this situation?

I tried launching ipython on both Terminal and xterm, both times experiencing the same behavior. So it doesn't appear to be the underlying shell that imposes limitations.

Here is my configuration again:

Mac OS 10.7.2 Lion (Macbook Air with 4 GB of memory - should be plenty)
python 2.7.2
qt 4.7.4
pyqt 4.9.1
vtk 5.8.0
ipython 0.12
mayavi 4.1.0

Everything is built from source using homebrew and pip. Flags are both for 64 and 32 bit, where 64bits takes precedence. This could be relevant...

Many thanks for your ideas,

Stefan





Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ipython prompt slows significantly after importing from mayavi

Robert Kern-2
On 2/17/12 1:11 PM, Stefan wrote:

> Hello,
>
> I have given up to get ipython qtconsole working with mayavi on my Mac for
> now.
>
> Unfortunately, it doesn't quite work on the plain ipython shell either. Most
> of the time, after importing anything from mayavi, e.g.
>
> from mayavi import mlab
>
> the ipython command prompt becomes so slow and unresponsive that it is
> impossible to work with. I say "most of the time", since about every fourth
> restart of ipython "survives" the mayavi import. If one gets lucky and gets
> such a "surviving" shell, it remains responsive even after subsequent mayavi
> commands. One could actually do some work then...

Qt is the culprit, here. The bit of IPython that integrates the terminal input
with the Qt event loop is not very responsive on OS X.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ipython prompt slows significantly after importing from mayavi

Jonathan Stickel
In reply to this post by Stefan
On 2/17/12 06:11 , Stefan wrote:
> Hello,
>
> I have given up to get ipython qtconsole working with mayavi on my Mac for
> now.

The tvtk/mayavi window hangs for me also when using qtconsole.

>
> Unfortunately, it doesn't quite work on the plain ipython shell either. Most
> of the time, after importing anything from mayavi, e.g.
>
> from mayavi import mlab
>
> the ipython command prompt becomes so slow and unresponsive that it is
> impossible to work with. I say "most of the time", since about every fourth
> restart of ipython "survives" the mayavi import. If one gets lucky and gets
> such a "surviving" shell, it remains responsive even after subsequent mayavi
> commands. One could actually do some work then...
>

Fortunately for me, I don't experience this.  I run ipython with:

$ export QT_API=pyqt
$ ipython --gui=qt

> Would be great if every "ipython" launch would predictable result in a
> workable environment, though.
>
> Hence my post. Is it possible that some buffer in ipython gets almost filled
> up when importing a large module? Can one increase this buffer? Any other
> ideas how one could remedy this situation?
>
> I tried launching ipython on both Terminal and xterm, both times
> experiencing the same behavior. So it doesn't appear to be the underlying
> shell that imposes limitations.
>
> Here is my configuration again:
>
> Mac OS 10.7.2 Lion (Macbook Air with 4 GB of memory - should be plenty)
> python 2.7.2
> qt 4.7.4
> pyqt 4.9.1
> vtk 5.8.0
> ipython 0.12
> mayavi 4.1.0
>
> Everything is built from source using homebrew and pip. Flags are both for
> 64 and 32 bit, where 64bits takes precedence. This could be relevant...
>

My configuration is (all installed via Macports):
Mac OS 10.6.8
python 2.6.7
qt 4.7.4
pyqt 4.9
vtk 5.6.1
ipyton 0.12
mayavi 4.1.0

Regards,
Jonathan
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ipython prompt slows significantly after importing from mayavi

Stefan
Hello Jonathan,

Thanks for the reply. Using:

$ export QT_API=pyqt
$ ipython --gui=qt

appears to work for me too. No lagging prompt anymore :-)

Thanks!
Stefan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ipython prompt slows significantly after importing from mayavi

Jonathan Stickel
On 2/17/12 08:47 , Stefan wrote:

> Hello Jonathan,
>
> Thanks for the reply. Using:
>
> $ export QT_API=pyqt
> $ ipython --gui=qt
>
> appears to work for me too. No lagging prompt anymore :-)
>
> Thanks!
> Stefan
>

Stefan

I tested some other things with ipython, and found that starting the
qtconsole with pylab=qt also works with mayavi (QT_API=pyqt is still
needed):

$ ipython qtconsole --pylab=qt

Doing this initializes the GUI loop correctly.  I don't see a way to
start the qtconsole with the GUI loop but without pylab, though.

Jonathan
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ipython prompt slows significantly after importing from mayavi

Stefan
Jonathan,

Yes, that works here as well!

Things are getting better: When launching mayavi from qtconsole, I can now even pick colors and lookup tables using the mayavi GUI. This didn't work with plain ipython. Also there appear to be fewer error messages on the console when closing mayavi windows ("trait exceptions", ...).

Loading --pylab without actually needing it seems like a small inconvenience. It doesn't appear to be affecting performance.

So this is starting to look like a stable working environment. Thanks again!

Stefan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ipython prompt slows significantly after importing from mayavi

Fernando Perez
In reply to this post by Jonathan Stickel
On Fri, Feb 17, 2012 at 8:51 AM, Jonathan Stickel <[hidden email]> wrote:
>
> Doing this initializes the GUI loop correctly.  I don't see a way to
> start the qtconsole with the GUI loop but without pylab, though.

Yup, it's a bug that we're not passing the --gui flag correctly to the kernel:

https://github.com/ipython/ipython/issues/1426

But you can start the console normally and then type in the qtconsole itself:

%gui qt

which will initialize the Qt event loop support for you, without loading pylab.

Cheers,

f
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Loading...