[IPython-dev] [MayaVi-users] Updated build of trunk-dev available

Fernando Perez fperez.net at gmail.com
Mon Jan 18 17:54:59 EST 2010


Hey,

On Mon, Jan 18, 2010 at 5:37 AM, Gael Varoquaux
<gael.varoquaux at normalesup.org> wrote:
>
> I am a bit surprised. Fernando, could it be that you don't have the QT
> backend installed for Traits? It will be named something like
> 'python-traitsbackendqt'.
>

Thanks, that was it!  I didn't realize I hadn't installed enough of
the traits packages on my Karmic box, sorry...

Now I do get a different error though:

In [3]: run qt_embedding.py
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

/home/fperez/Desktop/qt_embedding.py in <module>()
     17     Int, Dict
     18 from enthought.traits.ui.api import View, Item
---> 19 from enthought.mayavi.core.ui.api import MayaviScene, MlabSceneModel, \
     20         SceneEditor
     21 from enthought.mayavi import mlab

ImportError: No module named api


Is it possible to have a version of your script that runs with the
mayavi shipped in Karmic?

Because now with Gael's note and your script, I was able to test
things interactively:

In [1]: import os

In [2]: os.environ['ETS_TOOLKIT'] = 'qt4'

In [3]: gui qt

In [4]: from enthought.mayavi import mlab

In [5]: mlab.test_molecule ()
Out[5]:
(<enthought.mayavi.modules.glyph.Glyph object at 0xc949cbc>,
 <enthought.mayavi.modules.glyph.Glyph object at 0xd1002cc>,
 <enthought.mayavi.modules.glyph.Glyph object at 0xd13ecbc>,
 <enthought.mayavi.modules.glyph.Glyph object at 0xd152c8c>)

In [6]: mlab.figure()
Out[6]: <enthought.mayavi.core.scene.Scene object at 0xd2af65c>

In [7]: mlab.test_surf ()
Out[7]: <enthought.mayavi.modules.surface.Surface object at 0xdc381dc>

In [8]: mlab.test_surf ()
Out[8]: <enthought.mayavi.modules.surface.Surface object at 0xd16250c>

In [9]: pylab qt

Welcome to pylab, a matplotlib-based Python environment [backend: Qt4Agg].
For more information, type 'help(pylab)'.

In [10]: plt.figure()
Out[10]: <matplotlib.figure.Figure object at 0xdc5666c>

In [11]: plot(sin(linspace(0,2*pi,200)**2)
   ....: )
Out[11]: [<matplotlib.lines.Line2D object at 0xe69dbcc>]

In [12]:


And everything is fine: mayavi windows open up, their qt dialogs work,
I can then load pylab with the qt backend and it works, etc.  It's
*really* cool, in fact.

So I'd love to be able to reproduce your bug, so we can track it down
to either something we need to fix in ipython or something that can be
fixed upstream in mayavi...

Cheers,

f



More information about the IPython-dev mailing list