FORTH-ModelBasedTracker / PyOpenPose

Python bindings for the Openpose library
BSD 3-Clause "New" or "Revised" License
287 stars 80 forks source link

Python 3.6 Issues: Boost.Python.ArgumentError: Python argument types in #49

Closed veelion closed 6 years ago

veelion commented 6 years ago

Firstly, I build PyOPenPose with python 2.7, the scripts/OpLoop.py works fine.

Secondly, I build it with python 3.6, building is fine, but run scripts/OpLoop.py by getting the error:

Traceback (most recent call last): File "OpLoop.py", line 95, in run() File "OpLoop.py", line 42, in run op = OP.OpenPose((320, 240), (240, 240), (640, 480), b"COCO", MODELS, 0, download_heatmaps) Boost.Python.ArgumentError: Python argument types in OpenPose.init(OpenPose, tuple, tuple, tuple, bytes, bytes, int, bool) did not match C++ signature: init(object*, cv::Size, cv::Size, cv::Size, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, int, bool, OpenPoseWrapper::ScaleMode, bool, bool, int) init(object*, cv::Size, cv::Size, cv::Size, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, int, bool, OpenPoseWrapper::ScaleMode, bool, bool) init(object*, cv::Size, cv::Size, cv::Size, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, int, bool, OpenPoseWrapper::ScaleMode, bool) init(object*, cv::Size, cv::Size, cv::Size, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, int, bool, OpenPoseWrapper::ScaleMode) init(object*, cv::Size, cv::Size, cv::Size, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, int, bool) init(object*, cv::Size, cv::Size, cv::Size, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >, int) init(object*, cv::Size, cv::Size, cv::Size) init(_object) init(_object)

Does anyone know how to solve this error? thanks.

padeler commented 6 years ago

This looks like a boost-python issue. Make sure you link with the correct boost-python lib for python3.

veelion commented 6 years ago

I think it links the correct boost-python lib for python3, but it also links for python 2, why? The ldd info is here:

(py3.6)veelion@ebu-box:/datazfs/dl/pyOpenPose$ ldd ~/.virtualenvs/py3.6/lib/python3.6/site-packages/PyOpenPose.so |grep python libboost_python36.so.1.67.0 => /usr/local/lib/libboost_python36.so.1.67.0 (0x00007f55dcf3c000) libpython3.6m.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0 (0x00007f55dc889000) libpython2.7.so.1.0 => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 (0x00007f55be210000) libboost_python-py27.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0 (0x00007f55bdfc4000)

veelion commented 6 years ago

It seems like a problem of boost-python for python 3.6 (I'm not sure), if I changed: op = OP.OpenPose((320, 240), (240, 240), (640, 480), b"COCO", MODELS, 0, download_heatmaps) to: op = OP.OpenPose((320, 240), (240, 240), (640, 480), b"COCO", MODELS, 0) It works well. I guess there is a problem of default arguments of init/constructor. see: https://stackoverflow.com/questions/8140155/boost-python-confused-about-similar-constructor

padeler commented 6 years ago

Good to know @veelion thnx!

Which version of boost-python are you using?

veelion commented 6 years ago

I'm using boost-python 1.67

$ ldd PyOpenPose.so |grep boost libboost_python36.so.1.67.0 => /usr/local/lib/libboost_python36.so.1.67.0 (0x00007fe59ac18000) libboost_system.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.58.0 (0x00007fe59115f000) libboost_thread.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.58.0 (0x00007fe590f39000) libboost_filesystem.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.58.0 (0x00007fe590d21000) libboost_python-py27.so.1.58.0 => /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0 (0x00007fe57bca0000)

padeler commented 6 years ago

You are mixing two different versions of boost (1.67, 1.58). This can lead to weird issues like the one your are having. I would recommend to try using only one boost version unless you know there are no compatibility issues.

veelion commented 6 years ago

You are right, the boost-1.58 was dependented by libopenpose.so. So I rebuild openpose with 1.67, and the problem gone. Thanks.