之前一直在1080Ti上执行Faster R-CNN的gpu_nms等函数(这些函数是用C/C++写的,是对python的扩展,需要利用Cython进行编译),但最近转移到2080Ti上后,重新编译这部分,一直报以下错误:
running build_ext
skipping 'nms/cpu_nms.c' Cython extension (up-to-date)
building 'nms.cpu_nms' extension
{'gcc': ['-Wno-cpp', '-Wno-unused-function']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/b622/anaconda3/include/python3.7m -c nms/cpu_nms.c -o build/temp.linux-x86_64-3.7/nms/cpu_nms.o -Wno-cpp -Wno-unused-function
nms/cpu_nms.c: In function ‘__pyx_pf_3nms_7cpu_nms_2cpu_soft_nms’:
nms/cpu_nms.c:3172:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
__pyx_t_8 = ((__pyx_v_pos < __pyx_v_N) != 0);
^
nms/cpu_nms.c:3683:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
__pyx_t_8 = ((__pyx_v_pos < __pyx_v_N) != 0);
^
nms/cpu_nms.c: In function ‘__Pyx_PyCFunction_FastCall’:
nms/cpu_nms.c:8431:13: error: too many arguments to function ‘(PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t))meth’
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nms/cpu_nms.c: In function ‘__Pyx__ExceptionSave’:
nms/cpu_nms.c:8892:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
*type = tstate->exc_type;
^~~~~~~~
curexc_type
nms/cpu_nms.c:8893:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
nms/cpu_nms.c:8894:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
nms/cpu_nms.c: In function ‘__Pyx__ExceptionReset’:
nms/cpu_nms.c:8901:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
nms/cpu_nms.c:8902:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
nms/cpu_nms.c:8903:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
nms/cpu_nms.c:8904:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
nms/cpu_nms.c:8905:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
nms/cpu_nms.c:8906:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
nms/cpu_nms.c: In function ‘__Pyx__GetException’:
nms/cpu_nms.c:8961:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
nms/cpu_nms.c:8962:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
nms/cpu_nms.c:8963:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
nms/cpu_nms.c:8964:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
nms/cpu_nms.c:8965:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
nms/cpu_nms.c:8966:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
error: command 'gcc' failed with exit status 1
注:
1080Ti的环境为:CUDA9.0、Pytorch0.3.1
2080Ti的环境为:CUDA10.0、Pytorch1.0.1
(其实和环境没有关系)
解决方法
然后开始各种百度,出现最多的是以下解决方法(但这种方法并不适合我的情况,只是列举出来,万一大家出现的是这种呢):
对于python2:
sudo apt-get install python-dev
对于python3(依次在终端输入以下指令):
sudo apt-get install python3-dev
sudo apt-get install libevent-dev
上述方法解决的是由于python开发环境没有正确安装导致的command 'gcc' failed with exit status 1错误。
接着就是另一种解决方法(也不适合我的情况,也只是列举出来,哎,百度已经解决不了我的问题了):
pip安装:
pip install cython
pip3安装:
pip3 install cython
conda安装:
conda install cython
原因就是没有安装cython导致的command 'gcc' failed with exit status 1错误,所以需要安装一下cyhton(其实我是直接安装的Anaconda3,装完后自带cython的好像,一开始没有意识到,就开始疯狂装各种版本的cython,其实毫无卵用)。
还试过的一种不适合我的情况的方法就是更新gcc和g++版本(并同步gcc和g++版本,两者版本不一样会报错):
ubuntu下安装gcc/g++ 7(在终端依次输入以下指令)
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-7
sudo apt-get install g++-7
安装完成后输入以下指令链接上gcc/g++ 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
或者通过以下指令进行链接
cd /usr/bin #进入/usr/bin文件夹下
sudo rm -r gcc #移除之前的软连接
sudo ln -sf gcc-7 gcc #建立软连接
sudo rm -r g++ #同gcc
sudo ln -sf g++-7 g++
也可以通过以下指令直接选择一个版本的gcc/g++
sudo update-alternatives --config gcc
如上图,我现在的版本是gcc/g++ 7
可以通过以下指令来判断gcc和g++版本是否一致:
gcc -v
g++ -v
最后的最后就是适合我的情况的方法了,真的很简单又很暴力(我试了一晚上和一早上各种方法后,突然观察到的方法):
方法很简单,就是删除掉各种Cython生产的之前的文件:
删除掉下面第一张图中的build文件夹、__pycache__文件夹、__init_.py文件,删除pycocotools文件夹(对应第二张图)下的__pycache__文件夹、__init_.py文件、_mask.c文件以及_mask.cpython-36m-x86_64-linux-gnu.so文件(可能不同的python版本,这个文件名不一样),删除nms文件夹(对应第三张图)下的__pycache__文件夹、__init_.py文件、cpu_nms.c文件、gpu_nms.c文件、gpu_nms.cpp文件、cpu_nms.cpython-36m-x86_64-linux-gnu.so文件(可能不同的python版本,这个文件名不一样)、gpu_nms.cpython-36m-x86_64-linux-gnu.so(可能不同的python版本,这个文件名不一样)。就是彻底删除之前的生成文件即可。
至于为何我会想到这解决方法的,真的是观察出来的,一开始我删了部分文件,然后发现cpu_nms编译通过了,但报了以下类似的错误:
running build_ext
skipping 'nms/cpu_nms.c' Cython extension (up-to-date)
skipping 'nms/gpu_nms.cpp' Cython extension (up-to-date)
building 'nms.gpu_nms' extension
{'gcc': ['-Wno-unused-function'], 'nvcc': ['-arch=sm_61', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}
/usr/local/cuda-10.0/bin/nvcc -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda-10.0/include -I/home/b622/anaconda3/include/python3.7m -c nms/nms_kernel.cu -o build/temp.linux-x86_64-3.7/nms/nms_kernel.o -arch=sm_61 --ptxas-options=-v -c --compiler-options '-fPIC'
ptxas info : 0 bytes gmem
ptxas info : Compiling entry function '_Z10nms_kernelifPKfPy' for 'sm_61'
ptxas info : Function properties for _Z10nms_kernelifPKfPy
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info : Used 25 registers, 1280 bytes smem, 344 bytes cmem[0], 12 bytes cmem[2]
{'gcc': ['-Wno-unused-function'], 'nvcc': ['-arch=sm_61', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda-10.0/include -I/home/b622/anaconda3/include/python3.7m -c nms/gpu_nms.cpp -o build/temp.linux-x86_64-3.7/nms/gpu_nms.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from nms/gpu_nms.cpp:449:
/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^~~~~~~
nms/gpu_nms.cpp: In function ‘PyObject* __Pyx_PyCFunction_FastCall(PyObject*, PyObject**, Py_ssize_t)’:
nms/gpu_nms.cpp:5717:69: error: too many arguments to function
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
^
nms/gpu_nms.cpp: In function ‘void __Pyx__ExceptionSave(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
nms/gpu_nms.cpp:6243:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
*type = tstate->exc_type;
^~~~~~~~
curexc_type
nms/gpu_nms.cpp:6244:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
nms/gpu_nms.cpp:6245:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
nms/gpu_nms.cpp: In function ‘void __Pyx__ExceptionReset(PyThreadState*, PyObject*, PyObject*, PyObject*)’:
nms/gpu_nms.cpp:6252:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
nms/gpu_nms.cpp:6253:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
nms/gpu_nms.cpp:6254:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
nms/gpu_nms.cpp:6255:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
nms/gpu_nms.cpp:6256:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
nms/gpu_nms.cpp:6257:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
nms/gpu_nms.cpp: In function ‘int __Pyx__GetException(PyThreadState*, PyObject**, PyObject**, PyObject**)’:
nms/gpu_nms.cpp:6312:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
nms/gpu_nms.cpp:6313:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
nms/gpu_nms.cpp:6314:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
nms/gpu_nms.cpp:6315:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
nms/gpu_nms.cpp:6316:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
nms/gpu_nms.cpp:6317:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
error: command 'gcc' failed with exit status 1
可以发现是编译gpu_nms时发生了错误,然后我删除了这部分的,结果又发生类似的错误:
running build_ext
cythoning nms/cpu_nms.pyx to nms/cpu_nms.c
/home/b622/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/b622/Desktop/ECMNet/utils/nms/cpu_nms.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'nms.cpu_nms' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/nms
{'gcc': ['-Wno-cpp', '-Wno-unused-function']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/b622/anaconda3/include/python3.7m -c nms/cpu_nms.c -o build/temp.linux-x86_64-3.7/nms/cpu_nms.o -Wno-cpp -Wno-unused-function
nms/cpu_nms.c: In function ‘__pyx_pf_3nms_7cpu_nms_2cpu_soft_nms’:
nms/cpu_nms.c:3466:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
__pyx_t_8 = ((__pyx_v_pos < __pyx_v_N) != 0);
^
nms/cpu_nms.c:3977:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
__pyx_t_8 = ((__pyx_v_pos < __pyx_v_N) != 0);
^
gcc -pthread -shared -B /home/b622/anaconda3/compiler_compat -L/home/b622/anaconda3/lib -Wl,-rpath=/home/b622/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/nms/cpu_nms.o -o /home/b622/Desktop/ECMNet/utils/nms/cpu_nms.cpython-37m-x86_64-linux-gnu.so
cythoning nms/gpu_nms.pyx to nms/gpu_nms.cpp
/home/b622/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/b622/Desktop/ECMNet/utils/nms/gpu_nms.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'nms.gpu_nms' extension
{'gcc': ['-Wno-unused-function'], 'nvcc': ['-arch=sm_75', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}
/usr/local/cuda-10.0/bin/nvcc -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda-10.0/include -I/home/b622/anaconda3/include/python3.7m -c nms/nms_kernel.cu -o build/temp.linux-x86_64-3.7/nms/nms_kernel.o -arch=sm_75 --ptxas-options=-v -c --compiler-options '-fPIC'
ptxas info : 0 bytes gmem
ptxas info : Compiling entry function '_Z10nms_kernelifPKfPy' for 'sm_75'
ptxas info : Function properties for _Z10nms_kernelifPKfPy
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info : Used 27 registers, 1280 bytes smem, 376 bytes cmem[0]
{'gcc': ['-Wno-unused-function'], 'nvcc': ['-arch=sm_75', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda-10.0/include -I/home/b622/anaconda3/include/python3.7m -c nms/gpu_nms.cpp -o build/temp.linux-x86_64-3.7/nms/gpu_nms.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from nms/gpu_nms.cpp:607:
/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^~~~~~~
g++ -pthread -shared -B /home/b622/anaconda3/compiler_compat -L/home/b622/anaconda3/lib -Wl,-rpath=/home/b622/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/nms/nms_kernel.o build/temp.linux-x86_64-3.7/nms/gpu_nms.o -L/usr/local/cuda-10.0/lib64 -Wl,-R/usr/local/cuda-10.0/lib64 -lcudart -o /home/b622/Desktop/ECMNet/utils/nms/gpu_nms.cpython-37m-x86_64-linux-gnu.so
skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-3.7/pycocotools
{'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -Ipycocotools -I/home/b622/anaconda3/include/python3.7m -c pycocotools/maskApi.c -o build/temp.linux-x86_64-3.7/pycocotools/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
pycocotools/maskApi.c: In function ‘rleDecode’:
pycocotools/maskApi.c:46:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for( k=0; k2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
^~
pycocotools/maskApi.c:227:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
^~~~
{'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -Ipycocotools -I/home/b622/anaconda3/include/python3.7m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.7/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
pycocotools/_mask.c: In function ‘__Pyx_PyCFunction_FastCall’:
pycocotools/_mask.c:12772:13: error: too many arguments to function ‘(PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t))meth’
return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pycocotools/_mask.c: In function ‘__Pyx__ExceptionSave’:
pycocotools/_mask.c:14254:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
*type = tstate->exc_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14255:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14256:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c: In function ‘__Pyx__ExceptionReset’:
pycocotools/_mask.c:14263:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14264:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14265:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c:14266:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14267:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14268:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c: In function ‘__Pyx__GetException’:
pycocotools/_mask.c:14323:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14324:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14325:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c:14326:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14327:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14328:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
error: command 'gcc' failed with exit status 1
这次是pycocotools部分发生了错误,然后突然就开窍了,把所有之前生成的文件全删了,再次编译就通过了(如下,整个人都清爽了):
running build_ext
cythoning nms/cpu_nms.pyx to nms/cpu_nms.c
/home/b622/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/b622/Desktop/utils/nms/cpu_nms.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'nms.cpu_nms' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/nms
{'gcc': ['-Wno-cpp', '-Wno-unused-function']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/home/b622/anaconda3/include/python3.7m -c nms/cpu_nms.c -o build/temp.linux-x86_64-3.7/nms/cpu_nms.o -Wno-cpp -Wno-unused-function
nms/cpu_nms.c: In function ‘__pyx_pf_3nms_7cpu_nms_2cpu_soft_nms’:
nms/cpu_nms.c:3466:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
__pyx_t_8 = ((__pyx_v_pos < __pyx_v_N) != 0);
^
nms/cpu_nms.c:3977:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
__pyx_t_8 = ((__pyx_v_pos < __pyx_v_N) != 0);
^
gcc -pthread -shared -B /home/b622/anaconda3/compiler_compat -L/home/b622/anaconda3/lib -Wl,-rpath=/home/b622/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/nms/cpu_nms.o -o /home/b622/Desktop/utils/nms/cpu_nms.cpython-37m-x86_64-linux-gnu.so
cythoning nms/gpu_nms.pyx to nms/gpu_nms.cpp
/home/b622/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/b622/Desktop/utils/nms/gpu_nms.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'nms.gpu_nms' extension
{'gcc': ['-Wno-unused-function'], 'nvcc': ['-arch=sm_61', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}
/usr/local/cuda-10.0/bin/nvcc -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda-10.0/include -I/home/b622/anaconda3/include/python3.7m -c nms/nms_kernel.cu -o build/temp.linux-x86_64-3.7/nms/nms_kernel.o -arch=sm_61 --ptxas-options=-v -c --compiler-options '-fPIC'
ptxas info : 0 bytes gmem
ptxas info : Compiling entry function '_Z10nms_kernelifPKfPy' for 'sm_61'
ptxas info : Function properties for _Z10nms_kernelifPKfPy
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas info : Used 25 registers, 1280 bytes smem, 344 bytes cmem[0], 12 bytes cmem[2]
{'gcc': ['-Wno-unused-function'], 'nvcc': ['-arch=sm_61', '--ptxas-options=-v', '-c', '--compiler-options', "'-fPIC'"]}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/cuda-10.0/include -I/home/b622/anaconda3/include/python3.7m -c nms/gpu_nms.cpp -o build/temp.linux-x86_64-3.7/nms/gpu_nms.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1824:0,
from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
from /home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from nms/gpu_nms.cpp:607:
/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it with " \
^~~~~~~
g++ -pthread -shared -B /home/b622/anaconda3/compiler_compat -L/home/b622/anaconda3/lib -Wl,-rpath=/home/b622/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/nms/nms_kernel.o build/temp.linux-x86_64-3.7/nms/gpu_nms.o -L/usr/local/cuda-10.0/lib64 -Wl,-R/usr/local/cuda-10.0/lib64 -lcudart -o /home/b622/Desktop/utils/nms/gpu_nms.cpython-37m-x86_64-linux-gnu.so
cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
/home/b622/anaconda3/lib/python3.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/b622/Desktop/utils/pycocotools/_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-3.7/pycocotools
{'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -Ipycocotools -I/home/b622/anaconda3/include/python3.7m -c pycocotools/maskApi.c -o build/temp.linux-x86_64-3.7/pycocotools/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
pycocotools/maskApi.c: In function ‘rleDecode’:
pycocotools/maskApi.c:46:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for( k=0; k2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
^~
pycocotools/maskApi.c:227:34: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
^~~~
{'gcc': ['-Wno-cpp', '-Wno-unused-function', '-std=c99']}
gcc -pthread -B /home/b622/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/b622/anaconda3/lib/python3.7/site-packages/numpy/core/include -Ipycocotools -I/home/b622/anaconda3/include/python3.7m -c pycocotools/_mask.c -o build/temp.linux-x86_64-3.7/pycocotools/_mask.o -Wno-cpp -Wno-unused-function -std=c99
gcc -pthread -shared -B /home/b622/anaconda3/compiler_compat -L/home/b622/anaconda3/lib -Wl,-rpath=/home/b622/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/pycocotools/maskApi.o build/temp.linux-x86_64-3.7/pycocotools/_mask.o -o /home/b622/Desktop/utils/pycocotools/_mask.cpython-37m-x86_64-linux-gnu.so