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

setup.py install 失败 #1

Closed
liuyuancv opened this issue Dec 9, 2020 · 6 comments
Closed

setup.py install 失败 #1

liuyuancv opened this issue Dec 9, 2020 · 6 comments

Comments

@liuyuancv
Copy link

很棒的工作!
在本地配置的时候,运行python setup.py install出现以下问题:
-- looking for PCL_COMMON
-- looking for PCL_KDTREE
-- looking for PCL_OCTREE
-- looking for PCL_SEARCH
-- looking for PCL_IO
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_GEOMETRY
-- looking for PCL_FEATURES
-- looking for PCL_SEGMENTATION
-- looking for PCL_SURFACE
-- looking for PCL_REGISTRATION
-- looking for PCL_RECOGNITION
-- looking for PCL_KEYPOINTS
-- looking for PCL_VISUALIZATION
-- looking for PCL_PEOPLE
-- looking for PCL_OUTOFCORE
-- looking for PCL_TRACKING
-- looking for PCL_APPS
-- Could NOT find PCL_APPS (missing: PCL_APPS_LIBRARY)
-- looking for PCL_MODELER
-- looking for PCL_IN_HAND_SCANNER
-- looking for PCL_POINT_CLOUD_EDITOR
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ACSC/segmentation/build/temp.linux-x86_64-3.7
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libproj.so', needed by '../lib.linux-x86_64-3.7/segmentation_ext.so'. Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/segmentation_ext.dir/all' failed
make[1]: *** [CMakeFiles/segmentation_ext.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

-- Could NOT find PCL_APPS (missing: PCL_APPS_LIBRARY) 这个具体是啥原因呢

@HViktorTsoi
Copy link
Owner

您好!

首先请先确定您已经安装了Eigen 3.2.5 以及 PCL 1.8

看这个报错,是缺少libproj.so这个库

首先检查一下在/usr/lib/x86_64-linux-gnu/下边是否有libproj.so.9这个库文件,如果有的话

sudo ln -s /usr/lib/x86_64-linux-gnu/libproj.so.9 /usr/lib/x86_64-linux-gnu/libproj.so

如果没有,尝试

sudo apt install libproj-dev

如果还有问题请在issue里更新, 我会及时跟进

@liuyuancv
Copy link
Author

感谢您的回复,解决完libproj.so这个问题后,出现了/usr/bin/ld: cannot find -lvtkproj4这样的问题
我参照https://github.com/PointCloudLibrary/pcl/issues/1594解决了,显示成功安装:
Scanning dependencies of target segmentation_ext
[ 50%] Building CXX object CMakeFiles/segmentation_ext.dir/segmentation.cpp.o
In file included from /home/ACSC/segmentation/segmentation.hpp:14:0,
from /home/ACSC/segmentation/segmentation.cpp:11:
/usr/include/pcl-1.7/pcl/visualization/cloud_viewer.h:202:14: warning: ‘template class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
std::auto_ptr<CloudViewer_impl> impl_;
^
In file included from /usr/include/c++/5/memory:81:0,
from /home/ACSC/segmentation/pybind11/include/pybind11/detail/common.h:159,
from /home/ACSC/segmentation/pybind11/include/pybind11/pytypes.h:12,
from /home/ACSC/segmentation/pybind11/include/pybind11/cast.h:13,
from /home/ACSC/segmentation/pybind11/include/pybind11/attr.h:13,
from /home/ACSC/segmentation/pybind11/include/pybind11/pybind11.h:44,
from /home/ACSC/segmentation/segmentation.cpp:6:
/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
template class auto_ptr;
^
[100%] Linking CXX shared module ../lib.linux-x86_64-3.7/segmentation_ext.so
[100%] Built target segmentation_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-3.7/segmentation_ext.so -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying segmentation_ext.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying segmentation_ext.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying segmentation_ext.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying segmentation_ext.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying segmentation_ext.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
creating 'dist/segmentation_ext-0.0.1-py3.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing segmentation_ext-0.0.1-py3.7-linux-x86_64.egg
removing '/opt/conda/lib/python3.7/site-packages/segmentation_ext-0.0.1-py3.7-linux-x86_64.egg' (and everything under it)
creating /opt/conda/lib/python3.7/site-packages/segmentation_ext-0.0.1-py3.7-linux-x86_64.egg
Extracting segmentation_ext-0.0.1-py3.7-linux-x86_64.egg to /opt/conda/lib/python3.7/site-packages
segmentation-ext 0.0.1 is already the active version in easy-install.pth

Installed /opt/conda/lib/python3.7/site-packages/segmentation_ext-0.0.1-py3.7-linux-x86_64.egg
Processing dependencies for segmentation-ext==0.0.1
Finished processing dependencies for segmentation-ext==0.0.1

但是 在导入模块的时候出现以下问题:

import segmentation_ext
Traceback (most recent call last):
File "", line 1, in
ImportError: dynamic module does not define module export function (PyInit_segmentation_ext)

请问是什么原因呢

@HViktorTsoi
Copy link
Owner

这个是由于编译segmentation ext的时候和运行calibration.py的时候使用了不一致的python环境(即使您这边activate的是同样的环境, 由于conda的某些配置, pybind11找到的也是不一致的环境, 这个问题在python3.x的环境下最有可能发生)

目前这个问题最快的解决办法是切换到python2.7, 在2.7下编译segmentaion_ext并在2.7下运行calibraiton

在python3下的解决办法晚些再恢复您,因为我这边自己的python3都是可以正常运行的,需要找一个环境来复现这个bug

@HViktorTsoi
Copy link
Owner

HViktorTsoi commented Dec 9, 2020

您好, 找到问题了,这是一个由您本机的环境,PCL,Boost, conda,以及pybind11耦合在一起导致的及其复杂的bug.... 问题的表现就是在python3环境下编译segmentation_ext的时候, 无法找到正确的python解释器版本.

如果您想使用python3的话, 目前一个不太优雅的解决办法:

  1. 首先确保当前所在的conda环境是最终要编译segmentation_ext并运行calibration.py的环境

  2. 在命令行输入以下代码,

python -c "from sysconfig import get_paths;print(get_paths()['include'])"

它会输出一个路径, 类似/opt/conda/include/python3.7这样的,具体的输出要看您的环境. 复制这个路径.

  1. 在segmentaion/CMakeList.txt的第5行下边加这一句代码:

include_directories(第2步复制的路径)

比如 include_directories(/opt/conda/include/python3.7), 具体的内容要看您第2步的输出.

然后保存.

  1. 重新运行

python setup.py install

编译并安装segmentation_ext插件.

如果仍然使用python2.7, 则不需要做更改.

@liuyuancv
Copy link
Author

感谢感谢,终于调通了

@HViktorTsoi
Copy link
Owner

HViktorTsoi commented Mar 25, 2022

您好, 找到问题了,这是一个由您本机的环境,PCL,Boost, conda,以及pybind11耦合在一起导致的及其复杂的bug.... 问题的表现就是在python3环境下编译segmentation_ext的时候, 无法找到正确的python解释器版本.

如果您想使用python3的话, 目前一个不太优雅的解决办法:

  1. 首先确保当前所在的conda环境是最终要编译segmentation_ext并运行calibration.py的环境
  2. 在命令行输入以下代码,

python -c "from sysconfig import get_paths;print(get_paths()['include'])"

它会输出一个路径, 类似/opt/conda/include/python3.7这样的,具体的输出要看您的环境. 复制这个路径.

  1. 在segmentaion/CMakeList.txt的第5行下边加这一句代码:

include_directories(第2步复制的路径)

比如 include_directories(/opt/conda/include/python3.7), 具体的内容要看您第2步的输出.

然后保存.

  1. 重新运行

python setup.py install

编译并安装segmentation_ext插件.

如果仍然使用python2.7, 则不需要做更改.

Another a little bit hacky solution:

  1. First, sudo mv /usr/include/python2.7 /usr/include/python2.7.keep
  2. Then, complie the segmentation extension
  3. Last, sudo mv /usr/include/python2.7.keep /usr/include/python2.7

Reference: SMRT-AIST/fast_gicp#66 (comment)

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