url-kaist / patchwork-plusplus

Patchwork++: Fast and robust ground segmentation method for 3D LiDAR scans. @ IROS'22
GNU General Public License v3.0
668 stars 105 forks source link

I cannot run python example code (demo_sequential.py and demo_visualize). I get cannot find pypatchworkpp! #25

Closed khaledmohamedgamal closed 1 year ago

khaledmohamedgamal commented 1 year ago
seungjae24 commented 1 year ago

Hi @khaledmohamedgamal,

Could you please try sudo make install after make? I'm not sure that it solve the problem, but please try it and let me know your progress. I will try to find other potential causes. Thank you.

khaledmohamed00 commented 1 year ago

Thanks a lot @seungjae24 for your reply, and the work you have done in this repo, I found the solution it is related that I have many version of python in my machine, and pybind11 when creating the .so, it used the python version in usr/local. For example, I have conda environment with python 3.9, but the python that pybind11 sees is python 3.7; therefore, when I tried to import pypatchworkpp from python script with python version different than the python version that pybind11 sees, I got this error.

Here is the solution to specify the python version: The target Python version can be selected by setting PYBIND11_PYTHON_VERSION or an exact Python installation can be specified with PYTHON_EXECUTABLE when you run cmake. For example:

cmake -DPYBIND11_PYTHON_VERSION**=3**.6 ..

# Another method: cmake -DPYTHON_EXECUTABLE**=**/path/to/python ..

seungjae24 commented 1 year ago

Thank you for sharing your problem and solution, @khaledmohamed00!

It will help others who may struggle similar situation as you. Thank you once again :)