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

error: command 'g++' failed with exit status 1, maybe due to python version #98

Open
Tran-Nam opened this issue Dec 28, 2020 · 14 comments

Comments

@Tran-Nam
Copy link

I try to compile DCNv2 in my project use CenterNet. But i got this error. My environment use torch 1.7.0 and torchvision 0.8.1
I have checked python version. I realized with python3.6, DCN compile successfully, but with python3.7 and python3.8, i got this error.
Here is some output when i run ./make.sh

/hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:219:53: warning: �T* at::Tensor::data() const [with T = float]� is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations]
grad_weight.data<scalar_t>(), n_);
^
In file included from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Tensor.h:3:0,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Context.h:4,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/ATen.h:9,
from /hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4:
/opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here
T * data() const {
^~~~
error: command 'g++' failed with exit status 1

@Shuyun-Wang
Copy link

I try to compile DCNv2 in my project use CenterNet. But i got this error. My environment use torch 1.7.0 and torchvision 0.8.1
I have checked python version. I realized with python3.6, DCN compile successfully, but with python3.7 and python3.8, i got this error.
Here is some output when i run ./make.sh

/hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:219:53: warning: �T* at::Tensor::data() const [with T = float]� is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations]
grad_weight.data<scalar_t>(), n_);
^
In file included from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Tensor.h:3:0,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Context.h:4,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/ATen.h:9,
from /hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4:
/opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here
T * data() const {
^~~~
error: command 'g++' failed with exit status 1

I use 3090 ,and before i change '['ninja', '-v']' to '['ninja', '--version']',error is 'compute_86 '
and now the error is same to you

@albertchristian92
Copy link

Before I have same problem with you, but after I install ninja, the error became:

File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py", line 482, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py", line 1238, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py", line 1538, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

@biscuit279
Copy link

Before I have same problem with you, but after I install ninja, the error became:

File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py", line 482, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py", line 1238, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/usr/local/lib/python3.7/dist-packages/torch/utils/cpp_extension.py", line 1538, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

I had the same problem as you, have you already fixed this ?

@Xpangz
Copy link

Xpangz commented Mar 7, 2021

After I changed the '['ninja', '-v']' to '['ninja', '--v']', and used ‘export TORCH_CUDA_ARCH_LIST="5.0"’ to solve the 'compute_75' from torch/torch7#1190. I meet the same error! what should I do?

@artes14
Copy link

artes14 commented May 1, 2021

having the same problem here... any ideas?

@fgqile
Copy link

fgqile commented Jun 4, 2021

i have the same problem, is there anyone can resolve it. thank you pretty . the coda as follow.

    /data/m/src/lib/models/networks/DCNv2/src
['/data/m/src/lib/models/networks/DCNv2/src', '/user/local/cuda/include']
running install
running bdist_egg
running egg_info
writing DCNv2.egg-info/PKG-INFO
writing dependency_links to DCNv2.egg-info/dependency_links.txt
writing top-level names to DCNv2.egg-info/top_level.txt
reading manifest file 'DCNv2.egg-info/SOURCES.txt'
writing manifest file 'DCNv2.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building '_ext' extension
gcc -pthread -B /home/user/anaconda3/envs/rtm37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src -I/user/local/cuda/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/TH -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda:/usr/local/cuda/include -I/home/user/anaconda3/envs/rtm37/include/python3.7m -c /data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/vision.cpp -o build/temp.linux-x86_64-3.7/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -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++
gcc -pthread -B /home/user/anaconda3/envs/rtm37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src -I/user/local/cuda/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/TH -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda:/usr/local/cuda/include -I/home/user/anaconda3/envs/rtm37/include/python3.7m -c /data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp -o build/temp.linux-x86_64-3.7/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -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 /home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/ATen/cuda/CUDAContext.h:5:0,
                 from /data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4:
/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/c10/cuda/CUDAStream.h:6:30: fatal error: cuda_runtime_api.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

@Liuzirui666
Copy link

i have the same problem, is there anyone can resolve it. thank you pretty . the coda as follow.

    /data/m/src/lib/models/networks/DCNv2/src
['/data/m/src/lib/models/networks/DCNv2/src', '/user/local/cuda/include']
running install
running bdist_egg
running egg_info
writing DCNv2.egg-info/PKG-INFO
writing dependency_links to DCNv2.egg-info/dependency_links.txt
writing top-level names to DCNv2.egg-info/top_level.txt
reading manifest file 'DCNv2.egg-info/SOURCES.txt'
writing manifest file 'DCNv2.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_ext
building '_ext' extension
gcc -pthread -B /home/user/anaconda3/envs/rtm37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src -I/user/local/cuda/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/TH -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda:/usr/local/cuda/include -I/home/user/anaconda3/envs/rtm37/include/python3.7m -c /data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/vision.cpp -o build/temp.linux-x86_64-3.7/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -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++
gcc -pthread -B /home/user/anaconda3/envs/rtm37/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src -I/user/local/cuda/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/TH -I/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda:/usr/local/cuda/include -I/home/user/anaconda3/envs/rtm37/include/python3.7m -c /data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp -o build/temp.linux-x86_64-3.7/data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_ext -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 /home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/ATen/cuda/CUDAContext.h:5:0,
                 from /data/1lpx/RTM3D-m/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4:
/home/user/anaconda3/envs/rtm37/lib/python3.7/site-packages/torch/include/c10/cuda/CUDAStream.h:6:30: fatal error: cuda_runtime_api.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

have you figured this out? I met the exact same problem.

@artes14
Copy link

artes14 commented Aug 25, 2021

for weeks I have tried, and mine came out using YOLACT++
I could not figure this out but came with several solutions that other people have tried
(somehow mine worked repeating these....)

  1. compile DCN with python 3.6 (as mentioned by @Tran-Nam)

I try to compile DCNv2 in my project use CenterNet. But i got this error. My environment use torch 1.7.0 and torchvision 0.8.1
I have checked python version. I realized with python3.6, DCN compile successfully, but with python3.7 and python3.8, i got this error.

  1. reinstall DCNv2 with torch==1.4 torchvision==0.5
pip install -U torch==1.4 torchvision==0.5 -f https://download.pytorch.org/whl/cu101/torch_stable.html  
pip install DCNv2
  1. after running ./make.sh delete build folder and run ./make.sh again (this came from stackoverflow, but can't find link now)

I'm not sure which triggered to work, but DCNv2 works fine now......
sorry for this unclear solution

@ltqqq
Copy link

ltqqq commented Sep 22, 2021

for weeks I have tried, and mine came out using YOLACT++
I could not figure this out but came with several solutions that other people have tried
(somehow mine worked repeating these....)

  1. compile DCN with python 3.6 (as mentioned by @Tran-Nam)

I try to compile DCNv2 in my project use CenterNet. But i got this error. My environment use torch 1.7.0 and torchvision 0.8.1
I have checked python version. I realized with python3.6, DCN compile successfully, but with python3.7 and python3.8, i got this error.

  1. reinstall DCNv2 with torch==1.4 torchvision==0.5
pip install -U torch==1.4 torchvision==0.5 -f https://download.pytorch.org/whl/cu101/torch_stable.html  
pip install DCNv2
  1. after running ./make.sh delete build folder and run ./make.sh again (this came from stackoverflow, but can't find link now)

I'm not sure which triggered to work, but DCNv2 works fine now......
sorry for this unclear solution

May I ask your CUDA version?

@artes14
Copy link

artes14 commented Sep 23, 2021

May I ask your CUDA version?

> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:32:27_Pacific_Daylight_Time_2019
Cuda compilation tools, release 10.2, V10.2.89

@Vadbeg
Copy link

Vadbeg commented Oct 9, 2021

I've solved those issues.

Environment:

cuda version == 11.4
python version == 3.8.10

Installation:

  1. Install torch 1.4:
    pip install torch==1.4.0 torchvision==0.5.0
  2. Remove build folder in DCNv2 if exists
  3. Run ./make.sh
  4. Run python testcuda.py
    If it raises this error Jacobian mismatch for output 0 with respect to input 1, relax. Backbone still works fine (at least in my experiments)

@xjtAlgo
Copy link

xjtAlgo commented Nov 23, 2021

I try to compile DCNv2 in my project use CenterNet. But i got this error. My environment use torch 1.7.0 and torchvision 0.8.1
I have checked python version. I realized with python3.6, DCN compile successfully, but with python3.7 and python3.8, i got this error.
Here is some output when i run ./make.sh
/hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:219:53: warning: �T* at::Tensor::data() const [with T = float]� is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations]
grad_weight.data<scalar_t>(), n_);
^
In file included from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Tensor.h:3:0,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Context.h:4,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/ATen.h:9,
from /hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4:
/opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here
T * data() const {
^~~~
error: command 'g++' failed with exit status 1

I use 3090 ,and before i change '['ninja', '-v']' to '['ninja', '--version']',error is 'compute_86 ' and now the error is same to you

您好,请问最后这个问题您解决了吗,我现在也是3090的显卡,卡在这一步了,能方便告知后续您的环境配置吗

@kingoo123
Copy link

I try to compile DCNv2 in my project use CenterNet. But i got this error. My environment use torch 1.7.0 and torchvision 0.8.1
I have checked python version. I realized with python3.6, DCN compile successfully, but with python3.7 and python3.8, i got this error.
Here is some output when i run ./make.sh
/hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:219:53: warning: �T* at::Tensor::data() const [with T = float]� is deprecated: Tensor.data() is deprecated. Please use Tensor.data_ptr() instead. [-Wdeprecated-declarations]
grad_weight.data<scalar_t>(), n_);
^
In file included from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Tensor.h:3:0,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/Context.h:4,
from /opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/ATen.h:9,
from /hdd/projects/hti-traffic/src/deploy/CenterNet/src/lib/models/networks/DCNv2/src/cpu/dcn_v2_cpu.cpp:4:
/opt/anaconda3/envs/csp3.7/lib/python3.7/site-packages/torch/include/ATen/core/TensorBody.h:363:7: note: declared here
T * data() const {
^~~~
error: command 'g++' failed with exit status 1

I use 3090 ,and before i change '['ninja', '-v']' to '['ninja', '--version']',error is 'compute_86 ' and now the error is same to you

您好,请问最后这个问题您解决了吗,我现在也是3090的显卡,卡在这一步了,能方便告知后续您的环境配置吗

请问您解决了吗?我也遇到了相同的问题,麻烦告知,万分感谢

@Zijie-Tian
Copy link

Same problem, ask the answer.

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