about Grigoris Maravelias
Installing matplotlib-1.1.0 in Ubuntu 10.10 (64bit)

Installing matplotlib-1.1.0 in Ubuntu 10.10 (64bit)

Ubuntu 10.10 includes matplotlib-0.99 in their repositories, which is not the latest one, so you don’t get the latest cool features (like gridspec)! But as I need some of its features I decided to go on and install the latest version matplotlib-1.1.0, only 20 days after its launch !

First of all it cannot be found in any debian repositories and Ubuntu 11.10 includes the 1.0.1 version (though I found some debian packages but it is either in “testing” mode or unstable). So the only solution seemed to build it from scratch …

After some search a reliable post was found and by following the commands matplotlib-1.1.0 was successfully built and installed. After downloading the latest version for matplotlib, untar it into a directory (it can be safely deleted afterwards) and follow these commands:

In order to build you need to install:
sudo apt-get install build-essential
and these dependencies:
sudo apt-get install python-dev python-scipy libfreetype6-dev libpng12-dev zlib1g-dev
[the last 3 libraries “libgtk2.0-dev python-gtk2-dev python-wxgtk2.8” found in the original post are not really needed, the libgtk2.0-dev & python-gtk2-dev were not included and python-wxgtk2.8 was already installed]

As it is stated in the post by Tim Teatro

” To see what we’re getting and why, read on.

  • python-dev needed pretty much any time you build pacakges for Python.
  • python-scipy OR python-numpy matplotlib is made to interface with these. Even if you don’t use them in your programs, it is part of the matplotlib backed, since the numerics are very efficient compared to plain Python.
  • libfreetype6-dev is a high-quality font engine.
  • libpng12-dev for raster images
  • zlib1g-dev for compression
  • libgtk2.0-dev is the GUI toolkit I prefer, since I generally use Gnome. If you prefer Qt or Tk or otherwise, read the INSTALL file included with the matplotlib tarball. The compile script will try detect your preferred GUI toolkit, so just install the developer package for your preferred toolkit.
  • python-gtk2-dev to interface GTK with Python.
  • python-wxgtk2.8 wxWidgets is a higher level library for developing GUIs. The python-wxgtk2.8 package is a Python implementation of wxWidgets using GTK for the back-end.”

To finalize the procedure:
python setup.py build
sudo python setup.py install

The installation of the new matplotlib version can be found at /usr/local/lib/python2.6/dist-packages/ . If there is no error when running matplotlib but still you cannot see any plot then probably the backend must change. Go to the matplotlibrc file and edit the backend:
cd /usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/
sudo gedit matplotlibrc &

and find the keyword backend and change it accordingly. The value that worked for me was WXAgg.

Useful stuff: commands for matplotlib  / running a script with keyword ––verbose-helpful (check what is printed)

Leave a Reply

Your email address will not be published. Required fields are marked *