3

I'm trying to install mapnik on Windows XP.

After diligently following the instructions on their website (http://trac.mapnik.org/wiki/WindowsInstallation), it fails with the message:

    File "<stdin>", line 1, in <module>
    File "C:\mapnik-0.7.1\python\2.6\site-packages\mapnik\__init__.py", line 43, in <module> from _mapnik import *
    ImportError: DLL load failed: The specified procedure could not be found.

I tried the OSGEO4W installer as well, which is no more successful but before displaying the same error message also produces a pop-up saying:

    "The procedure entry point xmlCtxtReadMemory could not be located in the dynamic link library libxml2.dll."

The Trouble Shooting suggestions highlighted a couple of possible missing dlls. I installed both of those but failed to resolve the problem.

Dependency Walker identified a further three missing dlls, which I also installed, and yet still without solving the problem.

Any suggestions hugely appreciated!

D Maxwell
  • 323
  • 1
  • 4
  • 8
  • Here is the answer (sorry, it won't let me submit it as an answer, only as a comment): The problem was that there were multiple versions of the file "libxml2.dll" on the machine. The oldest (dated 24/11/2003), and apparently the one being used in preference to the others, was in the location: "C:\Windows\libxml2.dll" Renaming that version to "libxml2.dll-old" enabled mapnik to find its own installed version. – D Maxwell Sep 28 '11 at 00:18

3 Answers3

6

This is quite an old thread. However I just ran into the same problem and was able to solve it with different hints which I found across the web.

  1. I had to make sure that I have the 32bit version of Python. I used Windows x86 MSI Installer (2.7.2)
  2. I set the PATH variable for Python: C:\Program Files (x86)\Python27
  3. I downloaded and installed Mapnik v2.2.0 Windows 32 bit Package (so no SDK version)
  4. I set the PATH variables for the lib and the bin folder in this order: C:\Program Files\mapnik-v2.2.0\lib;C:\Program Files\mapnik-v2.2.0\bin (here comes the important part: make sure you put these two entries at the very beginning of the path variable as stated by zvolsky at https://github.com/mapnik/mapnik-packaging/issues/109)
  5. Make sure you have the libxml2.dll in your c:\windows folder as mentioned by Joan Natalie at Installing Mapnik 2.2.0 in windows 7 with Python 2.7 I just copied the dll file from my mapnik install folder C:\Program Files\mapnik-v2.2.0\lib

After that I was able to execute the command "import mapnik" without any issues. I was also able to execute the python demo as stated here at number 5: https://gist.github.com/springmeyer/5651701

So I guess I had two problems. First the fact that I was somehow missing the libxml2.dll file and second that because I put the mapnik entries in the PATH variable at the end, python somehow took a wrong one since there are many of the same dll's on my system.

Hope I could provide the missing solution here.

Community
  • 1
  • 1
n0daft
  • 125
  • 3
  • 7
  • I was getting the ImportError until I moved the mapnik entries to the beginning of my PATH. No other changes necessary. – yoyo Jan 04 '15 at 23:52
  • It might be often the case that adjusting the PATH variable is enough. However in my case there were the two above mentioned problems which I had to resolve in order to get it to work. – n0daft Jan 07 '15 at 12:52
  • 1
    In addition you may need to install this package too : https://www.microsoft.com/en-in/download/confirmation.aspx?id=5555 – Mahmoud Moravej Jun 14 '16 at 11:45
0

I had the same problem (on windows server 2012 R2). i searched a lot on google and i tried all of the above answers. btw today mapnik is fixed the libxml2.dll by linking with static address.

And Finally my problem was using double quotation in first and last of the mapnik lib path("C:\mapnik-v2.2.0\lib") in PATH variable!!!!

you should NOT use double quotation in system environment variables.

i changed "C:\mapnik-v2.2.0\lib" to C:\mapnik-v2.2.0\lib and every thing works fine. ;)

Mohy66
  • 390
  • 2
  • 12
0

Try installing libxml / libxml2 for windows. Seems you might be missing that as a dependancy or yourl libxml2.dll may be out of date. zlatkovic.com is the place for windows binaries of libxml:

libxml(2)

Downloads here: ftp://ftp.zlatkovic.com/libxml/

chown
  • 51,908
  • 16
  • 134
  • 170
  • 1
    Thanks, this didn't quite work, but it was enough of a hint to find the answer. I am going to provide the solution in a full answer. – D Maxwell Sep 28 '11 at 00:05
  • 1
    D Maxwell, we're waiting for that answer! – airstrike Mar 20 '13 at 18:02
  • Hi, just seen your comment above. Unfortunately it didn't let me add a full response so I had to add it as a comment to the original question. See above. – D Maxwell Jun 25 '14 at 18:09