First, fetch datasource from OSM. To manually create your datasource follow:
You can also, fetch data from:
download .osm.bz2 file. Then unzip the file and rename it.
After that open python interpreter. Then create map and style it. For, the code go to: https://abhinavhanda.wordpress.com/2017/06/17/mapnik/
Now, give permission to the requried .shp file from your datasource so that it can be executed. You can check permission status of your file using command: ll and then use:
chmod 777 /address of file/file.shp
Now, you can connect your datasource in your python interpreter.
Create a .py file and copy code from: https://abhinavhanda.wordpress.com/2017/06/17/mapnik/ into your .py file.
Your data has been rendered and you will get a .png image as output.