chensong1995 / HybridPose

HybridPose: 6D Object Pose Estimation under Hybrid Representation (CVPR 2020)
MIT License
418 stars 64 forks source link

Import Error: Ransac Voting Layer - undefined symbo #18

Closed Lynne-Zheng-Linfang closed 4 years ago

Lynne-Zheng-Linfang commented 4 years ago

Hi, I followed the instructions to do the training, however, the code terminated with the following error:

Exception has occurred: ImportError
/home/linfang/Documents/Code/HybridPose/lib/ransac_voting_gpu_layer/ransac_voting.so: undefined symbol: _ZN6caffe26detail37_typeMetaDataInstance_preallocated_32E
  File "/home/linfang/Documents/Code/HybridPose/lib/ransac_voting_gpu_layer/ransac_voting_gpu.py", line 3, in <module>
    import lib.ransac_voting_gpu_layer.ransac_voting as ransac_voting
  File "/home/linfang/Documents/Code/HybridPose/trainers/coretrainer.py", line 10, in <module>
    from lib.ransac_voting_gpu_layer.ransac_voting_gpu import ransac_voting_layer_v3
  File "/home/linfang/Documents/Code/HybridPose/src/train_core.py", line 12, in <module>
    from trainers.coretrainer import CoreTrainer

When I was compiling the Ransac Voting Layer, there was a warning about the torch C++ extension. I tried to add #include <torch/extrension.h> into ransac_voting.cpp, but it didn't work. It seems that the error is related to the version of Pytorch, could you please share the torch version?

running build_ext
building 'ransac_voting' extension
gcc -pthread -B /home/linfang/anaconda3/envs/hybridpose/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/TH -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/THC -I/home/linfang/anaconda3/envs/hybridpose/include/python3.7m -c ./src/ransac_voting.cpp -o build/temp.linux-x86_64-3.7/./src/ransac_voting.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=ransac_voting -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from ./src/ransac_voting.cpp:1:0:
/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:11:4: warning: #warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h" [-Wcpp]
 #  warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h"
    ^~~~~~~
/usr/bin/nvcc -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/TH -I/home/linfang/anaconda3/envs/hybridpose/lib/python3.7/site-packages/torch/include/THC -I/home/linfang/anaconda3/envs/hybridpose/include/python3.7m -c ./src/ransac_voting_kernel.cu -o build/temp.linux-x86_64-3.7/./src/ransac_voting_kernel.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=ransac_voting -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
g++ -pthread -shared -B /home/linfang/anaconda3/envs/hybridpose/compiler_compat -L/home/linfang/anaconda3/envs/hybridpose/lib -Wl,-rpath=/home/linfang/anaconda3/envs/hybridpose/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/./src/ransac_voting.o build/temp.linux-x86_64-3.7/./src/ransac_voting_kernel.o -L/usr/lib -lcudart -o build/lib.linux-x86_64-3.7/ransac_voting.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/ransac_voting.cpython-37m-x86_64-linux-gnu.so -> 
chensong1995 commented 4 years ago

Hello Linfang,

This error is unexpected to me. After some online searches, I suspect it has something to do with your CUDA version. My workstation has CUDA 10.1, and I am also able to compile the code on our department server which runs CUDA 10.0.

Lynne-Zheng-Linfang commented 4 years ago

Hello Linfang,

This error is unexpected to me. After some online searches, I suspect it has something to do with your CUDA version. My workstation has CUDA 10.1, and I am also able to compile the code on our department server which runs CUDA 10.0.

Hi, my CUDA version is 10.0. It is the problem with my virtual environment setting. I already solved it. Thank you!

chensong1995 commented 4 years ago

I'm glad to hear it! It would be helpful if you can post your steps to resolve the problem here. Other people are going to be benefited from that.

WHHHHY commented 1 year ago

林芳你好, 这个错误出乎我的意料。网上查了一下,怀疑和你的CUDA版本有关系。我的工作站有 CUDA 10.1,我也可以在运行 CUDA 10.0 的部门服务器上编译代码。

你好,我的CUDA版本是10.0。这是我的虚拟环境设置的问题。我已经解决了。谢谢你! Hello,

Hello Linfang, This error is unexpected to me. After some online searches, I suspect it has something to do with your CUDA version. My workstation has CUDA 10.1, and I am also able to compile the code on our department server which runs CUDA 10.0.

Hi, my CUDA version is 10.0. It is the problem with my virtual environment setting. I already solved it. Thank you!

Hello,Linfang, I encountered the same error as you,but,it seems like didn't work when I changed the version of CUDA,could you tell me how to fix this error,thank you !