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

RuntimeError: Error compiling objects for extension #25

Closed
zoujinger opened this issue Dec 24, 2020 · 3 comments
Closed

RuntimeError: Error compiling objects for extension #25

zoujinger opened this issue Dec 24, 2020 · 3 comments

Comments

@zoujinger
Copy link

Hi, could someone help me?

when I Compiling CUDA operators, this error happens:

(deformable_detr) zyi@ZHU:~/Documents/Project/Deformable-DETR/models/ops$ sh ./make.sh
running build
running build_py
running build_ext
building 'MultiScaleDeformableAttention' extension
Emitting ninja build file /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] /usr/local/cuda-10.2/bin/nvcc -DWITH_CUDA -I/home/zyi/Documents/Project/Deformable-DETR/models/ops/src -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/TH -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/home/zyi/anaconda3/envs/deformable_detr/include/python3.7m -c -c /home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cuda/ms_deform_attn_cuda.cu -o /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cuda/ms_deform_attn_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
FAILED: /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cuda/ms_deform_attn_cuda.o
/usr/local/cuda-10.2/bin/nvcc -DWITH_CUDA -I/home/zyi/Documents/Project/Deformable-DETR/models/ops/src -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/TH -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/home/zyi/anaconda3/envs/deformable_detr/include/python3.7m -c -c /home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cuda/ms_deform_attn_cuda.cu -o /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cuda/ms_deform_attn_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DCUDA_HAS_FP16=1 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 -std=c++14
/bin/sh: 1: /usr/local/cuda-10.2/bin/nvcc: not found
[2/2] c++ -MMD -MF /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.o.d -pthread -B /home/zyi/anaconda3/envs/deformable_detr/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/zyi/Documents/Project/Deformable-DETR/models/ops/src -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/TH -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/home/zyi/anaconda3/envs/deformable_detr/include/python3.7m -c -c /home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.cpp -o /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.o
c++ -MMD -MF /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.o.d -pthread -B /home/zyi/anaconda3/envs/deformable_detr/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/zyi/Documents/Project/Deformable-DETR/models/ops/src -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/TH -I/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/home/zyi/anaconda3/envs/deformable_detr/include/python3.7m -c -c /home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.cpp -o /home/zyi/Documents/Project/Deformable-DETR/models/ops/build/temp.linux-x86_64-3.7/home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=MultiScaleDeformableAttention -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/zyi/Documents/Project/Deformable-DETR/models/ops/src/cpu/ms_deform_attn_cpu.cpp:14:0:
/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/include/ATen/cuda/CUDAContext.h:5:30: fatal error: cuda_runtime_api.h: No such file or directory
compilation terminated.
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1423, in _run_ninja_build
check=True)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/subprocess.py", line 512, 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 "setup.py", line 70, in
cmdclass={"build_ext": torch.utils.cpp_extension.BuildExtension},
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 603, in build_extensions
build_ext.build_extensions(self)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 196, in build_extension
_build_ext.build_extension(self, ext)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 437, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1163, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/zyi/anaconda3/envs/deformable_detr/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1436, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension

My CUDA version is 10.1 install pytorch==1.5.1 torchvision==0.6.1

@zoujinger
Copy link
Author

Sorry for bothering.
this issue is caused by PATH. I've solved it.

@kuiran
Copy link

kuiran commented Mar 6, 2021

Sorry for bothering.
this issue is caused by PATH. I've solved it.

How to solve this problem?

@ts-kim
Copy link

ts-kim commented May 22, 2021

Sorry for bothering.
this issue is caused by PATH. I've solved it.

How to solve this problem?

Try this solution
#10 (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

3 participants