Python argument types in DatasourceCache.register_datasources(str) did not match C++ signature
Hi,
I'm trying to build mapnik with python bindings on Ubuntu 16.04. I cloned the mapnik and python-mapnik repositories, installed all the required dependencies, and compiled both projects successfully.
But when I try to import mapnik from python, I get the following error:
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) [GCC 5.3.1 20160413] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import mapnik Traceback (most recent call last): File "
", line 1, in File "mapnik/init.py", line 1075, in register_plugins() File "mapnik/init.py", line 1057, in register_plugins DatasourceCache.register_datasources(path) Boost.Python.ArgumentError: Python argument types in DatasourceCache.register_datasources(str) did not match C++ signature: register_datasources(std::string)
I tried again with a fresh Ubuntu 15.10 install, and I got the same error. Then I tried again on Centos 7 and it worked.
I noticed that the libboost versions were different, 1.58 for Ubuntu and 1.53 for Centos.
For me, on Ubuntu 15.10, I am getting the same error while running testcase python setup.py test as well as on doing import mapnik
File "python-mapnik/mapnik/__init__.py", line 1075, in <module>
register_plugins()
File "python-mapnik/mapnik/__init__.py", line 1057, in register_plugins
DatasourceCache.register_datasources(path)
ArgumentError: Python argument types in
DatasourceCache.register_datasources(str)
did not match C++ signature:
register_datasources(std::string)
+1 Im also getting this error
Got this error too trying to install python-mapnik on ubuntu 16. Also I tried apt-get install python-mapnik and got link error at python - import mapnik.
Is there any way to get working mapnik on ubuntu16 ?
Import mapnik works for me, but running the example world.py does not (with the error similar to the OP's one):
Traceback (most recent call last): File "world.py", line 6, in <module> polygon_symbolizer = mapnik.PolygonSymbolizer('#113355') Boost.Python.ArgumentError: Python argument types in PolygonSymbolizer.__init__(PolygonSymbolizer, str) did not match C++ signature: __init__(_object*)
This result I get with the latest python-mapnik <origin/master> code at both:
- CentOS-7, boost-1.53.0-25.el7, mapnik-g85a6ef9 (as of 2016-07-19)
- FreeBSD-12, boost-1.55, mapnik-3.0.9.
I went ahead, at CentOS-7. I built and installed boost-1.61, recent mapnik, python-mapnik. The result is the same.
<
% yum list installed boost* mapnik
Installed Packages
boost-devel.x86_64 1.61-1 @/boost-devel-1.61-1.x86_64
boost-libs-std.x86_64 1.61-1 @/boost-libs-std-1.61-1.x86_64
mapnik.x86_64 v3.0.11_184_g9a0d7b0-1 @/mapnik-v3.0.11_184_g9a0d7b0-1.x86_64
python-mapnik.x86_64 0.0.20160726_1c4a51d-1 @/python-mapnik-0.0.20160726_1c4a51d-1.x86_64
Same here (Ubuntu 16.04, libboost 1.58). Anyone know a solution/workaround?
edit: I used the egg-file from https://pypi.python.org/pypi/mapnik#downloads and it works w/o any problems.
+1 Same issue (Linux Mint 18, libboost 1.58, mapnik 3.x)
Same here on Ubuntu 16.04
Same here on Ubuntu 16.04. Does anyone have a solution for this yet?
Also looking at how we can fix this on Ubuntu 16.04. Rebuilding a machine that had a huge mapnik program and now I can't get it to run.
@rem260 I didn't know how but pycharm automatically installed mapnik when it was not found in my system.
Same problem today.
+1 for problem henrythaslers solution seems to work. Import no longer causes errors, but I haven't tried it calling it yet.
tomse: It worked for me no worries.
Somebody who has a hint to fix this bug. I am trying to use Python 3, so the pip wheel won't work for me?
Same problem.
Same problem.
I managed to make the python bindings working (at least import mapnik in python is working). I just deleted the .egg folder in the python-mapnik repository as it is advised in the README.txt of this folder ("However, it is safe to delete this directory."). However, the unit test are not working (python setup.py test) because they rewrite this .egg folder.
I hit this while building with MASON_BUILD=true. The python module got linked with system version of boost-python instead of the mason one. The system I'm on uses GLIBCXX_USE_CXX11_ABI=1 so it was not compatible.
I fixed it by export BOOST_PYTHON_LIB=boost_python to pass correct version of boost-python here.
Make sure you are not mixing incompatible libraries during linking. If you are linking dynamically, check that by:
ldd mapnik/_mapnik.so
I have the same problem too. mapnik tests run without an error, but can not import python-mapnik cause of the error reported on top.
- ubuntu 16.06
- python 2.7.12
- mapnik 3.1.0
any news on this?
I am getting an error too
same issue here ubuntu 16.04 mapnik 3.x compiled exactly by the instructions. ~/mapnik$ make test ---> Works ~/python-mapnik$ python setup.py test --> Does not work
this bug is kinda important isn't it? any ideas?
`====================================================================== ERROR: Failure: ArgumentError (Python argument types in DatasourceCache.register_datasources(str) did not match C++ signature: register_datasources(std::string))
Traceback (most recent call last):
File "/home/juan/python-mapnik-3/python-mapnik/.eggs/nose-1.3.7-py2.7.egg/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/home/juan/python-mapnik-3/python-mapnik/.eggs/nose-1.3.7-py2.7.egg/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/home/juan/python-mapnik-3/python-mapnik/.eggs/nose-1.3.7-py2.7.egg/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/home/juan/python-mapnik-3/python-mapnik/test/python_tests/webp_encoding_test.py", line 9, in
@talaj can you explain a bit more how did you manage to compile this? I don't quite understand how your suggested solution works
did you something like $export BOOST_PYTHON_LIB=boost_python $python setup.py install
?
@jucajuca I did it as you wrote. There were two boost-python libraries on my system and setup.py has chosen the bad one. I noticed these boost-python versions have different name so I set correct name in BOOST_PYTHON_LIB. I think that setting LD_LIBRARY_PATH should work as well.
Can multiple versions of libraries be also your case?
It never worked by compiling it by myself.
Hoewever, I discovered that some dependencies where pulled from a ppa:ubuntugis/ubuntugis-unstable. That repo has a newer version of mapnik and it broke everything. I removed the repo and:
sudo apt-get clean sudo apt-get install autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal1-dev libmapnik-dev mapnik-utils python-mapnik
hope this helps
I am facing the same problem on linux python2.7(osgeolive), I wonder how to fix it.
Boost.Python.ArgumentError: Python argument types in PolygonSymbolizer.init(PolygonSymbolizer, Color) did not match C++ signature: init(_object*)
I have the same issue when I am going to import mapnik
``
Traceback (most recent call last):
File "
``
One interesting issue is with installation process. why I get this log
Installed /usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg Processing dependencies for mapnik==3.1.0 Finished processing dependencies for mapnik==3.1.0
mapnik 3.1.0 ? I have installed last mapnik from source and also I have installed mapnik-python version 3.0.x what is 3.1.0?I have no idea where it was came from
Same issue. I installed mapnik from source using python3 (branch master), and the python bindings (using the master branch too).
import mapnik Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg/mapnik/init.py", line 1071, in register_plugins() File "/usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg/mapnik/init.py", line 1053, in register_plugins DatasourceCache.register_datasources(path) Boost.Python.ArgumentError: Python argument types in DatasourceCache.register_datasources(str) did not match C++ signature: register_datasources(std::string)
python3 setup.py install output has a final line: Installed /usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg Which is interesting as noted by @am2222 . The $mapnik-config --version outputs 4.0.0. Any ideas/hints?
Same issue. I installed mapnik from source using python3 (branch master), and the python bindings (using the master branch too).
import mapnik Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg/mapnik/init.py", line 1071, in register_plugins() File "/usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg/mapnik/init.py", line 1053, in register_plugins DatasourceCache.register_datasources(path) Boost.Python.ArgumentError: Python argument types in DatasourceCache.register_datasources(str) did not match C++ signature: register_datasources(std::string)
python3 setup.py install output has a final line: Installed /usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg Which is interesting as noted by @am2222 . The $mapnik-config --version outputs 4.0.0. Any ideas/hints?
I executed bootstrap.sh, and now mapnik-config --version outputs 3.0.22, but I still get the same error.