Matplotlib and basemap on Debian

Some installation instructions.

Installation

You will need to install it from source. It requires matplotlib. If you try to use the Debian package of matplotlib, you will soon see it is too old for basemap. Here is an example of an error :

So we need to install it from source. The latest (1.2.1) does not compile with the following error :

Going back to the previous version (1.2.0) works as a charm.

Using it

If you try to plot something and display it with plt.show(), it is likely you will not see something. So you need to change the backend (see the documentation for more information).

Choosing the correct backend depends on what you have installed. In any case, you have to create a file named matplotlibrc in $HOME/.matplotlib . Then put the chosen backend. I use

If you chose to use GTK, you may have the following error :

Then you have to reinstall matplotlib with GTK support. For that, copy setup.cfg.template to setup.cfg and uncomment the following :

Finally, run the install again.