Using the same script on installs with different EPD versions

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 *
except ImportError:
    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.

Installing the nVidia driver in Kubuntu 12.04

Running the vanilla install of Kubuntu 12.04 worked incredibly well. It took me quite some time to notice that I was in fact using the open source noveau driver. Dual displays, desktop effects and all other first impressions worked without glitches. In fact, it was not before I tried to run Google Maps’ WebGL version that I started noticing some rendering errors. And according to the noveau project’s own webpages, the OpenGL acceleration is exactly where noveau is still lacking.

In addition, the graphics card seemed to heat itself more easily with the noveau driver.

Sadly this lead me to realize that I would still have to use the proprietary NVIDIA driver to make use of my graphics card and the applications I use daily. Even worse, getting this installed would prove to harder than in earlier versions of Ubuntu. I don’t know if this is due to using Kubuntu or not, but if you should experience some of the same symptoms, here is how I fixed it.

First of all, the symptoms were as follows after installing the nvidia-current package:

  • The computer started only with one display and with a very low resolution (640 x 480)
  • Enabling the nvidia driver using jockey-kde or jockey-text resulted in errors such as
    • ERROR: XorgDriverHandler.enable(): package or module not installed, aborting
    • WARNING: modinfo for module nvidia_current_updates failed: ERROR: modinfo: could not find module nvidia_current_updates
  • Finally, installing nvidia-current only gave the error:
    • Module build for the currently running kernel was skipped since the
      kernel source for this kernel does not seem to be installed.

So, if you experience any of these, the reason is most likely missing kernel source and header libraries. The fix is thankfully simple, just run the following commands in a terminal:

sudo apt-get update
sudo apt-get purge nvidia-current
sudo apt-get install linux-source
sudo apt-get install linux-headers-generic
sudo apt-get install linux-image
sudo apt-get install nvidia-current
jockey-text -e xorg:nvidia_current

After this, if you get no errors, try to reboot and run


after booting. Now you should be able to set up and use your system with full graphics acceleration.

Good luck!