Install mapnik 2.3 with the python plugin

  • mapnik
  • python
  • OpenStreetMap
  • boost

Mapnik is a python librairy that creates png images from geographical sources like OpenStreetMap data, PostGIS databases and shapefiles. The librairy is mainly used to create the different map layers used in OpenStreetMap.

Mapnik can be extended with some plugins. One of this is the “python plugin” that allows to use python as a data source.

This article explain how to install mapnik with the python plugin for ubuntu 14.04. Indeed, the use of the python plugin installed with aptitude triggers a segfault. This segfault is generated by the boost librairy. The only way to use the python plugin is to reinstall boost with a patch and then to install mapnik from scratch. This post explains the method.

This article is based on this blog post and on this issue.

Install ICU

Follow the instructions from but choose /usr/local as prefix.

cd icu/source
./runConfigureICU Linux --prefix=/usr/local --enable-static
make install 

Install the Boost Librairy with the patch

Download and decompress the Boost Library source.

cd ~/Software/Boost
wget -O boost_1_56_0.tar.bz2
tar -xvf boost_1_56_0.tar.bz2

Edit the file libs/python/src/converter/builtin_converters.cpp as described here.

The lines

 void shared_ptr_deleter::operator()(void const*)

must be replaced by

 void shared_ptr_deleter::operator()(void const*)
PyGILState_STATE gil = PyGILState_Ensure();

Then, configure and install the Boost Library.

cd boost_1_56_0
./b2 install --prefix=/usr/local

Install mapnik 2.3

Download mapnik.

cd ~/Software/mapnik
git clone mapnik
git checkout 2.3.x
cd mapnik

Configure mapnik.


Install mapnik.

sudo make install

That’s it !

P.S. This article was written a few months after the installation of mapnik. So it is possible that some steps are missing. Please contact us if it is the case.