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.

{% highlight bash %} cd icu/source ./runConfigureICU Linux –prefix=/usr/local –enable-static make make install {% endhighlight %}

Install the Boost Librairy with the patch

Download and decompress the Boost Library source.

{% highlight bash %} cd ~/Software/Boost wget -O boost_1_56_0.tar.bz2 tar -xvf boost_1_56_0.tar.bz2 {% endhighlight %}

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

The lines

{% highlight c %} void shared_ptr_deleter::operator()(void const*) { owner.reset(); } {% endhighlight %}

must be replaced by

{% highlight c %} void shared_ptr_deleter::operator()(void const*) { PyGILState_STATE gil = PyGILState_Ensure(); owner.reset(); PyGILState_Release(gil); } {% endhighlight %}

Then, configure and install the Boost Library.

{% highlight bash %} cd boost_1_56_0 ./ ./b2 install –prefix=/usr/local {% endhighlight %}

Install mapnik 2.3

Download mapnik.

{% highlight bash %} cd ~/Software/mapnik git clone mapnik git checkout 2.3.x cd mapnik {% endhighlight %}

Configure mapnik.

{% highlight bash %} ./configure make {% endhighlight %}

Install mapnik.

{% highlight bash %} sudo make install {% endhighlight %}

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.