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:
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
in a terminal.
In the newest version of Enthought’s Python Distribution (EPD) on Ubuntu, the plotting package has been moved from enthought.mayavi.mlab to the shorter and more general mayavi.mlab. This does however mean that if you, like me, need to work with different versions of EPD on multiple systems, will experience the following error from time to time:
ImportError: No module named enthought.mayavi.mlab
Now, to avoid switching the import statement every time you switch systems, you can make Python check if one of the versions is installed during import. If it is not, we’ll tell it to try the other. This is done in this simple command:
from enthought.mayavi.mlab import *
from mayavi.mlab import *
Just replace any other similar import statements the same way and your code should once again be working across all your installations.
I was preparing to do some tasks in my physics course today, and experienced a rather annoying problem when attempting to use the python-visual package in Ubuntu.
There seems to be a bug in Ubuntu Karmic which results in the following output when trying to run this command:
from visual import *
The output is as follows:
Traceback (most recent call last):
File "cooper.py", line 1, in
from visual import *
File "/usr/lib/python2.6/dist-packages/visual/__init__.py", line 59, in
AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only
The fix is luckily quite simple.
Andrew Mitchell has a package repository for Ubuntu which contains an update to a library called “boost”. You can add this repository by selecting System > Administration > Software Sources. Then select “Other Software” and click on “Add…”.
Now, type in the following in the textbox:
Then click “Add source” and “Close”. If prompted, select “Reload” and then go to System > Administration > Update Manager. Click “Check” and then install all updates.
When this has been done, you are ready to run your python script.