stevenygd / PointFlow

PointFlow : 3D Point Cloud Generation with Continuous Normalizing Flows
https://www.guandaoyang.com/PointFlow/
MIT License
720 stars 101 forks source link

ImportError: No module named StructuralLossesBackend #1

Closed suprosanna closed 5 years ago

suprosanna commented 5 years ago

Traceback (most recent call last): File "test.py", line 4, in from metrics.evaluation_metrics import EMD_CD File "/media/Drives/PointFlow-master/metrics/evaluation_metrics.py", line 9, in from .StructuralLosses.match_cost import match_cost File "/media/Drives/PointFlow-master/metrics/StructuralLosses/match_cost.py", line 3, in from metrics.StructuralLosses.StructuralLossesBackend import ApproxMatch, MatchCost, MatchCostGrad ImportError: No module named StructuralLossesBackend

stevenygd commented 5 years ago

It occurs to be the case that the installation of CUDA kernels for metrics is not successful. Basically if you look into install.sh, there are the following lines:

# Compile CUDA kernel for CD/EMD loss
cd metrics/pytorch_structural_losses/
make clean
make
cd $root

If you rerun the following lines, you might see the error for the compilation. It could very well be the gcc/g++ version you have that leads to the compilation failure.

berwingan commented 3 years ago

@stevenygd was there a particular version that worked ?

I am using gcc 5.2.0 and when I compile I get this error and instead of the metric/StructuralLosses/StructuralLossesBackend directory I get a init.py , match_cost.py, nn_distance.py and StructuralLossessBackend.cpython-36m-x86_64-linux-gnu.so files in the metric/StructuralLosses/ directory.

building 'StructuralLossesBackend' extension creating build/temp.linux-x86_64-3.6 creating build/temp.linux-x86_64-3.6/pybind gcc -pthread -B /scratch/wqg203/conda-envs/pytorch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./ -I/scratch/wqg203/conda-envs/pytorch/lib/python3.6/site-packages/torch/lib/include -I/scratch/wqg203/conda-envs/pytorch/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/scratch/wqg203/conda-envs/pytorch/lib/python3.6/site-packages/torch/lib/include/TH -I/scratch/wqg203/conda-envs/pytorch/lib/python3.6/site-packages/torch/lib/include/THC -I/scratch/wqg203/conda-envs/pytorch2/include -I/scratch/wqg203/conda-envs/pytorch/include/python3.6m -c pybind/bind.cpp -o build/temp.linux-x86_64-3.6/pybind/bind.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=StructuralLossesBackend -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++

g++ -pthread -shared -B /scratch/wqg203/conda-envs/pytorch/compiler_compat -L/scratch/wqg203/conda-envs/pytorch/lib -Wl,-rpath=/scratch/wqg203/conda-envs/pytorch/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/pybind/bind.o -Lobjs -L/scratch/wqg203/conda-envs/pytorch2/lib64 -lmake_pytorch -lcudart -o build/lib.linux-x86_64-3.6/StructuralLossesBackend.cpython-36m-x86_64-linux-gnu.so