Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python argument types in DatasourceCache.register_datasources(str) did not match C++ signature #103

Open
filotti opened this issue Jun 13, 2016 · 37 comments

Comments

@filotti
Copy link

filotti commented Jun 13, 2016

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.

@gunjanmodi
Copy link

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)

@StarFi55ure
Copy link

+1 Im also getting this error

@Regressor
Copy link

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 ?

@bsamorodov
Copy link

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:

  1. CentOS-7, boost-1.53.0-25.el7, mapnik-g85a6ef9 (as of 2016-07-19)
  2. FreeBSD-12, boost-1.55, mapnik-3.0.9.

@bsamorodov
Copy link

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

@henrythasler
Copy link

henrythasler commented Jul 30, 2016

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.

@nurgasemetey
Copy link

nurgasemetey commented Sep 20, 2016

+1 Same issue (Linux Mint 18, libboost 1.58, mapnik 3.x)

@leifole
Copy link

leifole commented Sep 27, 2016

Same here on Ubuntu 16.04

@fxmzb123
Copy link

Same here on Ubuntu 16.04. Does anyone have a solution for this yet?

@rem260
Copy link

rem260 commented Oct 4, 2016

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.

@nurgasemetey
Copy link

nurgasemetey commented Oct 4, 2016

@rem260 I didn't know how but pycharm automatically installed mapnik when it was not found in my system.

@benboughton1
Copy link

Same problem today.

@tomse
Copy link

tomse commented Oct 20, 2016

+1 for problem
henrythaslers solution seems to work. Import no longer causes errors, but I haven't tried it calling it yet.

@benboughton1
Copy link

tomse: It worked for me no worries.

@jonatanhjul
Copy link

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?

@cahytinne
Copy link

Same problem.

1 similar comment
@nobohan
Copy link

nobohan commented Feb 7, 2017

Same problem.

@nobohan
Copy link

nobohan commented Feb 9, 2017

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.

@talaj
Copy link
Member

talaj commented Aug 18, 2017

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

@skasberger
Copy link

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?

@d3netxer
Copy link

I am getting an error too

@ghost
Copy link

ghost commented Apr 22, 2018

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
import mapnik
File "/home/juan/python-mapnik-3/python-mapnik/mapnik/init.py", line 1071, in
register_plugins()
File "/home/juan/python-mapnik-3/python-mapnik/mapnik/init.py", line 1053, 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)
`

@ghost
Copy link

ghost commented Apr 22, 2018

@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

?

@talaj
Copy link
Member

talaj commented Apr 22, 2018

@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?

@ghost
Copy link

ghost commented Apr 23, 2018

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

@ziya5635
Copy link

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*)

@am2222
Copy link

am2222 commented Feb 19, 2019

I have the same issue when I am going to import mapnik

``
Traceback (most recent call last):
File "", line 1, in
File "/home/m/.local/share/Trash/files/python-mapnik.2/python-mapnik/mapnik/init.py", line 1071, in
register_plugins()
File "/home/m/.local/share/Trash/files/python-mapnik.2/python-mapnik/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)

``

@am2222
Copy link

am2222 commented Feb 19, 2019

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

@soccerdroid
Copy link

soccerdroid commented Mar 6, 2019

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?

@soccerdroid
Copy link

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.

@am2222
Copy link

am2222 commented Mar 8, 2019

@soccerdroid Hi,
I managed to install it using mason_packages=true parameter but it seems if you build mapnik from source it has conflict with mapnik-python.

@am2222
Copy link

am2222 commented Mar 8, 2019

@soccerdroid As I tried this issue somehow is related into this one
#194
the lboost_python must be the same while compiling python and mapnik-python. I tried but no got no chance.

@soccerdroid
Copy link

hi @am2222
I don't understand quite well why, but the error disappears if I export PYTHONPATH="/usr/bin:$PYTHONPATH"
I tried adding "/usr/bin" to sys.path, but that doesn't work, possibly because that puts /usr/bin at the end of the list.
Any hints/ideas?

@soccerdroid
Copy link

Well, I solved the issue by moving /usr/local/lib/python3.6/dist-packages/mapnik-3.1.0-py3.6-linux-x86_64.egg to a different location, not included in PYTHONPATH (same as if I had just deleted the folder). Potentially related to @nobohan 's comment.

@am2222
Copy link

am2222 commented Mar 20, 2019

@soccerdroid Wow It is great I will try your method. But Does removing 'mapnik-3.1.0-py3.6-linux-x86_64.egg' from that directory ended up with compiling mapnik-python using its mason version of mapnik not the mapnik you have compiled installed on your machine from source?

@soccerdroid
Copy link

@soccerdroid Wow It is great I will try your method. But Does removing 'mapnik-3.1.0-py3.6-linux-x86_64.egg' from that directory ended up with compiling mapnik-python using its mason version of mapnik not the mapnik you have compiled installed on your machine from source?

I never built mapnik with mason_packages=True. I don't know if that answers your question. Let us know how did it go for you!

@am2222
Copy link

am2222 commented Mar 20, 2019

@soccerdroid Yes that was exactly my question, I'll check your solution and will let you know about the results.
Thanks so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests