Skip to content

Error importing pbcvt: undefined symbol: PyCMethod_New #10

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

Closed
Rajiv91 opened this issue Aug 9, 2023 · 5 comments
Closed

Error importing pbcvt: undefined symbol: PyCMethod_New #10

Rajiv91 opened this issue Aug 9, 2023 · 5 comments

Comments

@Rajiv91
Copy link

Rajiv91 commented Aug 9, 2023

Hey, i'm using a Ubuntu 22.04.3
I'm trying to run the repo with a conda env with python3.8.17, i already installed all the dependencies as described in the instructions, including detectron2, compile opencv (4.6), boost (latest v1.83) and pyboostcvconverter (replacing the opencv stuff and adding the cmake flags as suggested so it's generating the pbcvt.cpython-38-x86_64-linux-gnu.so successfully), everything looks good so far, but when i try to run the test example:
$ CUDA_VISIBLE_DEVICES=0 python track.py --num-gpus 1 --config-file mot17_track_cfg.py
I have the next runtime error importing pbcv inside sparse_tracker.py file:

from tracker import pbcvt 
ImportError: /lib/x86_64-linux-gnu/libboost_python310.so.1.74.0: undefined symbol: PyCMethod_New

I guess that libboost_python310.so.1.74.0 library is a result of the boost build that's why it's looking for in my system and not my conda env and with python3.10 and not 3.8 so should i use an older boost version where that PyCMethod_New symbol is available?
Also do i need to use a especific boost version along with a specific python version for the boost compilation? if so, how can i do this with my python environment instead of the one of my linux system, making that the pbcv loads the PyCMethod_New from the conda env path instead of my system? maybe with the cmake flags?
Thanks in advance.

@Xavier-Lin
Copy link
Member

@Rajiv91 I speculate that the bug may be due to the higher version of your boost software. Therefore, I'm providing you with a boost version that I have used: boost_1.74.0. In addition, the information about my conda environment build is as follows:
pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

Python 3.9.16

@Rajiv91
Copy link
Author

Rajiv91 commented Aug 10, 2023

Hi @Xavier-Lin thanks for the info, i already installed the versions of the packages you suggested me but now i have a different error during the cmake configuration:

-- Trying alternative Boost.Python component name, python39..
-- Trying alternative Boost.Python component name, python-py39...
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake:141 (find_package):
  Could not find a package configuration file provided by "boost_python-py39"
  (requested version 1.74.0) with any of the following names:

    boost_python-py39Config.cmake
    boost_python-py39-config.cmake

  Add the installation prefix of "boost_python-py39" to CMAKE_PREFIX_PATH or
  set "boost_python-py39_DIR" to a directory containing one of the above
  files.  If "boost_python-py39" provides a separate development package or
  SDK, be sure it has been installed.
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake:258 (boost_find_component)
  /usr/share/cmake-3.22/Modules/FindBoost.cmake:594 (find_package)
  CMakeLists.txt:68 (find_package)

Although it seems that the build of boost was successful and i didn't see any error. it seems it can't find the boost python component in my machine, do you think that something went wrong during the boost 1.74.0 compilation?
I just followed the instructions as described:

./bootstrap.sh
./b2 headers

without errors
do i need to configure python-boost paths for the boost compilation or pyboostconvert cmake config?

@Rajiv91
Copy link
Author

Rajiv91 commented Aug 10, 2023

I finally managed to fix these errors, basically i had to do 2 things, I put them below hoping that it will help someone else who runs with the same error:

  1. Compile boost enabling the python support specifically using the paths of my conda python (3.9) env, this is with bootstrap.sh and b2 script flags
  2. Modify the CMakeList.txt file making the cmake the boost config point to the directory where my build output was and not try to look in /usr/local:
    set(Boost_DIR pathToBoost/sparseTrack/boost/stage/lib/cmake/Boost-1.74.0)
    /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake can't find boost-python

Now i'm able to load the pbcvt.cpython-39-x86_64-linux-gnu.so successfully.

But before to close the issue, I wanted to see if you could help me with a question please.
I already download the bytetrack_x_mot17.pth.tar model and modify the mot17_track_cf.py with the location of that file, however it's crashing trying to find the annotations/test.json file:

File "/home/rajiv/Documents/python_repos/sparseTrack/SparseTrack/register_data.py", line 19, in load_coco_json
    coco_api = COCO(json_file)
  File "/home/rajiv/miniconda3/envs/sparse_env/lib/python3.9/site-packages/pycocotools/coco.py", line 81, in __init__
    with open(annotation_file, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/data/zelinliu/DanceTrack/dancetrack/annotations/test.json'

I know you said that we need to change the path of that file in the readme:
change the VAL_JSON and VAL_PATH in register_data.py.
but it is not clear to me what I should put now in those variables, should i download a annotations/test.json file, if so where can i download such a file?.
sorry if i am missing something obvious from the readme.

@Xavier-Lin
Copy link
Member

@Rajiv91
You need to modify the dataset file paths in the data generation script. For instance, you will need to modify the DATA_PATH in SparseTrack/tools/convert_mot17_to_coco.py.

@Rajiv91
Copy link
Author

Rajiv91 commented Aug 11, 2023

Amazing, thanks for your support @Xavier-Lin

@Rajiv91 Rajiv91 closed this as completed Aug 11, 2023
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

2 participants