Open ChenHoy opened 5 years ago
Hi @ChenHoy,
Can you help me work the issue out ? I meet the issue after building orbslam2.
Thanks
Failure to import like that indicates that python cannot find one of the referenced .so files when importing, even if your compiler could find them when it linked it. Probably one of the boost .so files.
Did you move orbslam2.so
after you created it?
You can inspect where orbslam2.so expects to find all it's dependencies by running ldd orbslam2.so
. IIRC, these are usually relative paths, so moving the file may break them.
You can add the built orbslam.so
to your virtualenv without moving it by using a symlink or a .pth file (see https://docs.python.org/3.7/library/site.html)
@jskinn Hi, I have compiled successfully in virtual environment, and used a symlink to add the built orbslam2.so to the virtualenv and checked dependencies are well. However, I am not luck to import it successfully. Can you help me solve the issue ? Thanks
A couple of issues:
sys.path
paths don't look like a virtualenv, they reference the system python location.This issue can also be caused if you're trying to build the project with OpenCV4 instead of OpenCV2 or 3.
Unfortunately the ORB_SLAM2 repository isn't compatible with OpenCV4 either. You can use this fork of the original repo to build under OpenCV4, however.
As far as this project is concerned, only a couple changes are needed to work with the aforementioned fork:
#if CV_VERSION_MAJOR >= 3
AccessFlag
instead of int
Hello, I am trying to use the bindinsg with Python3.7 and boost 1.71.
Both is found during the building process and no warnings or errors are raised. However, when I import orbslam2, I get the following ImportError: "ImportError: path/to/venv/lib/python3.7/site-packages/orbslam2.so: undefined symbol: _ZN5pbcvt26matToNDArrayBoostConverter7convertERKN2cv3MatE"
The paths to boost has been adjusted in CMakeLists.txt (Boost 1.71 REQUIRED COMPONENTS python37). Everything else was just adjusted to Python 3.7.
Hopefully, someone has an idea why this occurs. This error is similar to Issue #1, but I have explicitly set the paths correctly and the dependencies are apparently found correctly when building.
Thanks in advance for any help!