mapnik / python-mapnik

Python bindings for mapnik
GNU Lesser General Public License v2.1
157 stars 91 forks source link

Error: _mapnik.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyString_Type #189

Open Ogofo opened 6 years ago

Ogofo commented 6 years ago

Hey guys,

I installed mapnik from source and tried to install the python bindings as well. When I import mapnik I get an error. Can anyone help me?

(mapnik) prompt:~/python-mapnik$ mapnik-config -v
3.1.0
(mapnik) prompt:~/python-mapnik$  python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mapnik
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/.../python-mapnik/mapnik/__init__.py", line 74, in <module>
    from ._mapnik import *
ImportError: /home/.../python-mapnik/mapnik/_mapnik.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PyString_Type
sergeychibunin commented 6 years ago

I have a same problem

pinballwizard commented 5 years ago

I discovered that is due to the inconsistency of the libboost-python libraries and the python version for which mapnik is building. In my case, docker container python:3.6-strech had python3.5 as system and, accordingly, libboost-python1.62 but build for python3.6. Therefore, mapnik needs to be built for python3.5 or update libboost-python to version 1.67. I was build mapnik in a debian:buster container and it's work fine. But you can don't build mapnik and just take from ppa. In buster system python is 3.7 and mapnik in ppa build for it.