Adjusting to the new version of Pylab and Mayavi on Ubuntu 12.04

It seems the IPython and Pylab packages has also been updated in 12.04 and thus removing the old ipython -wthread flag that would ensure Mayavi plots to be run in a separate thread. Running with the flag causes this error to show up:

[TerminalIPythonApp] Unrecognized flag: '-wthread'

Without this flag, the Mayavi plots lock up the UI and hangs. If you want to get the possibility back to rotate and play around with the plots, just start IPython the following way from now on:

ipython --pylab=qt

This will launch IPython with the Qt backend and threading. Using only –pylab does not include threading. For easy and quick access, add the following to a file named .bashrc in your home folder:

alias pylab='ipython --pylab=qt'

From now on you can launch IPython just by typing

pylab

in a terminal.

Published by

Svenn-Arne Dragly

I'm a physicist and programmer, writing about the stuff I figure out as I go.

6 thoughts on “Adjusting to the new version of Pylab and Mayavi on Ubuntu 12.04”

  1. I am sorry to bother but you obviously know mayavi well.

    I have the following problem. I would be greatful if you could help me solve it.

    Thank you.

    If I run code from Python, the Mayavi2 plot window will either disappear really quick or if it doesn’t, I can’t interact with it because it freezes.

    However, if I run mayavi2 /path/to/code, I can interact with the figure without any issue.

    Additionally, if I run Mayavi2 normally, I receive in the logger the following error:

    could not restore editor [TVTK Scene 1]

    Then when I close Mayavi2 I receive this error:

    (python:1820): LIBDBUSMENU-GTK-CRITICAL **: watch_submenu: assertion `GTK_IS_MENU_SHELL(menu)’ failed

    If I run it as sudo, I receive

    (python:5288): IBUS-WARNING **: The owner of /home/dustin/.config/ibus/bus is not root!

    What is the deal with this program? How can I fix any of these issues?

    1. Hi! To run the Mayavi code from Python, you should start IPython with pylab activated. I think

      ipython --pylab=qt

      should work. Otherwise, try the -wthread option.

      ipython -wthread

      The reason is that this also loads multithreading, which is a requirement for Mayavi to run properly.

      The errors you receive are likely just a few bugs in GTK and VTK. I get those a lot for applications using those libraries, but they appear not to be anything to worry about.

      1. I have been starting ipython with –pylab=qt. The ipython -wthread option doesn’t seem to work. It says it is an unrecognized flag.

          1. I am using ubuntu 13.04 but this issue persisted on 12.04. I have had set in my bashrc ipython –pylab=qt.

            I have reinstalled mayavi a few times. I did a fresh install of 13.04 so I made sure I went through the mayavi, vtk, etc steps correctly.

Leave a Reply