More Mapnik Madness
Posted by Buadhai on 9 October 2009 in English. Last updated on 10 October 2009.So, yesterday I managed to get mapnik to run. Today, I get this:
——
Bleach:~ mnewman$ sudo python_select python26
Selecting version "python26" for python
Bleach:~ mnewman$ python
Python 2.6.3 (r263:75183, Oct 9 2009, 11:47:07)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik
Fatal Python error: Interpreter not initialized (version mismatch?)
Abort trap
——
I haven't done anything since successfully running mapnik yesterday, so how did a "version mismatch" materialize while I was sleeping?
Discussion
Comment from Buadhai on 10 October 2009 at 00:15
So, I've searched around the mapnik wiki and found my exact problem. But, this is the….
----
Solution: In general you must rebuild Mapnik to link against what ever version of Python the boost python library linked against, or rebuild boost from source which will likely link boost python against your system version of Python.
The otool command is how you find out what is linked against what library. In the following example, Boost python and Mapnik are both linked against the Python25 Apple installed version of Python on 10.5 (which works):
——
This is all over my head. Once again the geek-kings triumph over the map-serfs….
Comment from Buadhai on 10 October 2009 at 01:47
Since I couldn't make heads or tails of the mapnik wiki:
http://trac.mapnik.org/wiki/MacPythonUpgradeIssues
Which contains gems like:
"Mapnik will build just fine with your new python installation will not complain but when importing you get the "Fatal Python error: Interpreter not initialized (version mismatch?)". Check to see what your _mapnik.so is linking against."
and
"If, like the above command result, you see that your mapnik module it linked against 'opt' (the macports dir), then either remove boost from macports or switch to the macports version of python. Even if you pointed the SCons path variables at a different version of boost, the SCons linker found the macports version because it was on the library path of another one of your dependencies (In the above example, the JPEG_LIBS)."
I've decided to completely uninstall everything I installed from Macports and try again.
I hope Zartbitter reads this as it is at his invitation that I'm tilting at the Mapnik windmill….
Comment from Buadhai on 10 October 2009 at 08:08
Turns out that the problem is that boost ends up getting linked to the wrong version of Python. No worries, it's easy to fix with this simple little command:
sudo install_name_tool -change /System/Library/Frameworks/Python.framework/Versions/2.6/Python /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Python /opt/local/lib/libboost_python-mt.dylib
Now Mapnik is working on my Mac….