ThibaultGROUEIX / ChamferDistancePytorch

Chamfer Distance in Pytorch with f-score
MIT License
326 stars 43 forks source link

Compile error #7

Closed Salingo closed 4 years ago

Salingo commented 4 years ago

Hi, when I tried to run the unit_test, it returned an error shows below. Have you ever met this problem? I am using CUDA 10.1, PyTorch 1.3.1 Thank you!

Traceback (most recent call last):
  File "/home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1030, in _build_extension_module
    check=True)
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "unit_test.py", line 1, in <module>
    import torch, chamfer3D.dist_chamfer_3D, fscore
  File "/home/zihao/Nutstore/4DCompletion/code/complete_pc/ChamferDistancePytorch/chamfer3D/dist_chamfer_3D.py", line 13, in <module>
    "/".join(os.path.abspath(__file__).split('/')[:-1] + ["chamfer3D.cu"]),
  File "/home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 661, in load
    is_python_module)
  File "/home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 830, in _jit_compile
    with_cuda=with_cuda)
  File "/home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 883, in _write_ninja_file_and_build
    _build_extension_module(name, build_directory, verbose)
  File "/home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1043, in _build_extension_module
    raise RuntimeError(message)
RuntimeError: Error building extension 'chamfer_3D': [1/3] :/usr/local/cuda-10.1:/usr/local/cuda-10.1/bin/nvcc -DTORCH_EXTENSION_NAME=chamfer_3D -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/TH -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/THC -isystem :/usr/local/cuda-10.1:/usr/local/cuda-10.1/include -isystem /home/zihao/Nutstore/4DCompletion/venv/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -std=c++11 -c /home/zihao/Nutstore/4DCompletion/code/complete_pc/ChamferDistancePytorch/chamfer3D/chamfer3D.cu -o chamfer3D.cuda.o
FAILED: chamfer3D.cuda.o
:/usr/local/cuda-10.1:/usr/local/cuda-10.1/bin/nvcc -DTORCH_EXTENSION_NAME=chamfer_3D -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/TH -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/THC -isystem :/usr/local/cuda-10.1:/usr/local/cuda-10.1/include -isystem /home/zihao/Nutstore/4DCompletion/venv/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -std=c++11 -c /home/zihao/Nutstore/4DCompletion/code/complete_pc/ChamferDistancePytorch/chamfer3D/chamfer3D.cu -o chamfer3D.cuda.o
/bin/sh: 1: :/usr/local/cuda-10.1:/usr/local/cuda-10.1/bin/nvcc: not found
[2/3] c++ -MMD -MF chamfer_cuda.o.d -DTORCH_EXTENSION_NAME=chamfer_3D -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/TH -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/THC -isystem :/usr/local/cuda-10.1:/usr/local/cuda-10.1/include -isystem /home/zihao/Nutstore/4DCompletion/venv/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/zihao/Nutstore/4DCompletion/code/complete_pc/ChamferDistancePytorch/chamfer3D/chamfer_cuda.cpp -o chamfer_cuda.o
FAILED: chamfer_cuda.o
c++ -MMD -MF chamfer_cuda.o.d -DTORCH_EXTENSION_NAME=chamfer_3D -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/TH -isystem /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/THC -isystem :/usr/local/cuda-10.1:/usr/local/cuda-10.1/include -isystem /home/zihao/Nutstore/4DCompletion/venv/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/zihao/Nutstore/4DCompletion/code/complete_pc/ChamferDistancePytorch/chamfer3D/chamfer_cuda.cpp -o chamfer_cuda.o
In file included from /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/Device.h:3:0,
                 from /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/python.h:8,
                 from /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/extension.h:6,
                 from /home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:6,
                 from /home/zihao/Nutstore/4DCompletion/code/complete_pc/ChamferDistancePytorch/chamfer3D/chamfer_cuda.cpp:1:
/home/zihao/Nutstore/4DCompletion/venv/lib/python3.6/site-packages/torch/include/torch/csrc/python_headers.h:9:20: fatal error: Python.h: No such file or directory
compilation terminated.
ninja: build stopped: subcommand failed.
Salingo commented 4 years ago

Maybe it's because I'm using a virtual environment, so some files are missing?

ThibaultGROUEIX commented 4 years ago

Dear @Salingo Thanks for reaching out, I never had this. They are a few interesting threads : https://github.com/mapillary/inplace_abn/issues/104 https://github.com/mapillary/inplace_abn/issues/106#issuecomment-475460496 https://github.com/zhanghang1989/PyTorch-Encoding/issues/162 It looks like a path problem. This line is especially suspicious /bin/sh: 1: :/usr/local/cuda-10.1:/usr/local/cuda-10.1/bin/nvcc: not found Are you sure cuda 10.1 is correctly installed? (you can check in /usr/local/cuda-10.1)

Best regards, Thibault

Salingo commented 4 years ago

Hi, thanks for your reply, I have fixed the issue, indeed it is the problem with my path setting. Thanks again!

marsarCV commented 3 years ago

Hi, thanks for your reply, I have fixed the issue, indeed it is the problem with my path setting. Thanks again!

Hey! how did you set the paths, I am facing a similar problem

zhang-0515 commented 2 years ago

请问您解决这个问题了吗?我也遇到了这种情况