From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Mapnik/Installation
English русский

This page describes various ways of installing the Mapnik rendering program.

Current Installation instructions are also available at the Mapnik wiki.

Please note that you need mapnik 2.0.0 if you want to work with current versions of osm.xml
Otherwise you get lots of errors. The following guides are therefore outdated! However, most 
Linux distributions will get you mapnik 2 and all necessary dependencies via their package 
manager. Too easy!

For Debian Sid

See also

Mapnik 0.7.1 is already packaged so you can just install it!

# aptitude install python-mapnik

Mapnik 2.0 is also available.

# aptitude install python-mapnik2

Debian Lenny

Mapnik 0.5.1 is already packaged so you can just install it!

# aptitude install python-mapnik

For Debian Etch (oldstable) (Mapnik 0.5)

Configure your system with access to the repository (see

# apt-get update
# apt-get install python-mapnik

Feel free to contact with problems about the Debian packages. Note: there are no packages for amd64 only i386

Compiling the old Mapnik 0.5 from source on Debian Etch (oldstable)

Besides the dependencies listed above for Mapnik 0.4, you need iostreams from the boost library (where are they listed ?)

# aptitude install libboost-iostreams-dev
# apt-get install postgresql-dev libfreetype6-dev libxml2-dev libtiff4-dev libboost-regex-dev libboost-filesystem-dev libboost-python-dev

2nd line was added and worked for me, beware Sletuffe 19:48, 7 November 2008 (UTC)

Next you need to create some symbolic links. The last one for GDAL is not needed for OSM, but if you have it installed on your system and want to use it with Mapnik, then you need that link too.

# cd /usr/lib
# ln -s
# ln -s
# ln -s
# ln -s
# ln -s
# ln -s
# ln -s

Next compile and install Mapnik. "XMLPARSER=libxml2" at the end of each line, is only needed if you want to use XML entities in your style sheets. On etch you need g++-4.1 (not 3.x)

$ cd /path/where/you/unpacked/the/mapnik/0.5/source/
$ python scons/ PGSQL_INCLUDES=/usr/include/postgresql PROJ_INCLUDES=/usr/include PROJ_LIBS=/usr/lib XMLPARSER=libxml2
# python scons/ install PGSQL_INCLUDES=/usr/include/postgresql PROJ_INCLUDES=/usr/include PROJ_LIBS=/usr/lib XMLPARSER=libxml2

By default Mapnik is installed in /usr/local/lib so you need to add that path to /etc/ and run 'ldconfig' afterwards.

# echo "/usr/local/lib" >> /etc/
# ldconfig

For Microsoft Windows (Windows 2000 and above)

Also check the installation instructions in the Mapnik wiki which may be slightly more detailed or up-to-date.

  • Download Python 2.7 (Mind that Mapnik doesn't run on older or newer Python versions):
Note: Currently there is no 64bit version of mapnik

  • Install to C:\Python27
  • Add the lib dir to your PATH

Start - Control Panel - System - Advanced - Environment Variables

Append the following to your Systemvariables PATH setting:


Add mapnik to the PYTHONPATH setting, create variable if not existing


If you get errors, try to put the new path values before the existing ones.

  • Execute the Python command line. In Start - Run enter:
  • Enter this command:
from mapnik import *

If it does not work, check the trouble shooting hints in the mapnik wiki.

  • Exit by pressing "Ctrl + Z" or entering "quit()"

See also: Mapnik Windows Installation instructions


aptitude install pgsql-dev libboost1.37-dev libltdl7-dev proj python-cairo libcairomm-1.0-dev
Full guide:

To be check: for Ubuntu 10.04, it seems that some required DejaVu fonts are not any more installed by default. Fixed by calling 'sudo apt-get install ttf-dejavu-extra'

openSUSE 11.0

You need to add following package repository:

and then just install mapnik.

openSUSE 11.1

You need to add following package repository:

and then just install mapnik.

openSUSE 11.2 (from source)

First, if you have not already done so, add the Geo repository:

sudo zypper ar "Geo"
sudo zypper refresh

Then, install the required dependencies. (Note: I compiled this list of dependencies after already having the Osm2pgsql dependencies installed. I do not know which of those you need.)

sudo zypper install libjpeg-devel libtiff-devel libpng-devel boost-devel python-cairo-devel cairomm-devel libicu-devel libtool

Use Subversion to fetch the latest stable version of Mapnik and OpenStreetMap's Mapnik-scripts. At the time of writing, that was 0.7.1.

svn export mapnik-0.7.1
svn export

Build the Mapnik Python module:

cd mapnik-0.7.1/
# in the following line, you can omit everything after "" if you do not want to optimize the build or want to run the build on other machines.
python scons/ CXX="g++ -march=native -O2 -fomit-frame-pointer" configure
python scons/
sudo python scons/ install
sudo ldconfig
cd ../mapnik/

Edit the Mapnik-based tile script ( in the mapnik directory) to only generate the tiles you want. Open it, and look for the comment "Change the following for". You can use one of the commands below it or write your own. Be sure to add a '#'-sign in front of every line you do not need, otherwise you will be generating a lot of tiles you don't want.

For example, to generate zoom levels six through eightteen for the Benelux, add the following lines:

# To generate zoom levels 6 through 18 for the Benelux, add the following two lines:
bbox = ( 2.26, 49.23, 7.41, 53.74 )
render_tiles( bbox, mapfile, tile_dir, 6, 18, "Benelux" )

As you might have guessed, the "bbox" defines a bounding box or rectangle on the world using GPS coordinates for which tiles should be created. It is defined by the coordinates of the lower left and upper right corner of that rectangle. In this example, those are (2.26, 49.23) and (7.41, 53.74), respectively.

To generate tiles for other areas, add the coordinates between the parenthesis after "bbox" and change the six and eightteen in the line below the bbox to correspond to the minimum and maximum zoom levels you want.

Another example, generating tiles for the entire world for zoom levels zero through five:

# To generate zoom levels 0 to 5 for the entire world
bbox = ( -180.0, -90.0, 180.0, 90.0 )
render_tiles( bbox, mapfile, tile_dir, 0, 5, "World" )


Mapnik 0.7.1 is already packaged so you can just install it! At the moment this is still marked unstable, so you might need to adapt your accept keywords.

# emerge mapnik


On FreeBSD Mapnik is available for installing from source and from ports.

For installing from Mapnik from port, enter following command:
#cd /usr/ports/graphics/mapnik
#make install
For installing from source go to to get needed archive of source (e.g. mapnik-0.7.1.tar.bz2), and enter following command:
#cd "full path to mapnik-0.7.1.tar.bz2"
#tar zxvf mapnik-0.7.1.tar.bz2
#python scons/ configure
#python scons/ 
#python scons/ install

For check of a correctness of installation do the operations described in the document Mapnik:_Rendering_OSM_XML_data_directly.

Fedora 18

For more specific installation steps on Fedora 10, follow these steps: Mapnik/Fedora Installation.