roytseng-tw / Detectron.pytorch

A pytorch implementation of Detectron. Both training from scratch and inferring directly from pretrained Detectron weights are available.
MIT License
2.82k stars 567 forks source link

sh make.sh error cython incompatible? #158

Closed szrlee closed 5 years ago

szrlee commented 5 years ago

Expected results

compiling successfully.

Actual results

failed.

Detailed steps to reproduce

sh make.sh

running build_ext
building 'utils.cython_bbox' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/utils
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/numpy/core/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c utils/cython_bbox.c -o build/temp.linux-x86_64-3.7/utils/cython_bbox.o -Wno-cpp
utils/cython_bbox.c: In function ‘__Pyx__ExceptionSave’:
utils/cython_bbox.c:6052:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
     *type = tstate->exc_type;
                   ^
utils/cython_bbox.c:6053:20: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
     *value = tstate->exc_value;
                    ^
utils/cython_bbox.c:6054:17: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
     *tb = tstate->exc_traceback;
                 ^
utils/cython_bbox.c: In function ‘__Pyx__ExceptionReset’:
utils/cython_bbox.c:6061:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
     tmp_type = tstate->exc_type;
                      ^
utils/cython_bbox.c:6062:23: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
     tmp_value = tstate->exc_value;
                       ^
utils/cython_bbox.c:6063:20: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
     tmp_tb = tstate->exc_traceback;
                    ^
utils/cython_bbox.c:6064:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
     tstate->exc_type = type;
           ^
utils/cython_bbox.c:6065:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
     tstate->exc_value = value;
           ^
utils/cython_bbox.c:6066:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
     tstate->exc_traceback = tb;
           ^
utils/cython_bbox.c: In function ‘__Pyx__GetException’:
utils/cython_bbox.c:6121:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
     tmp_type = tstate->exc_type;
                      ^
utils/cython_bbox.c:6122:23: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
     tmp_value = tstate->exc_value;
                       ^
utils/cython_bbox.c:6123:20: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
     tmp_tb = tstate->exc_traceback;
                    ^
utils/cython_bbox.c:6124:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’
     tstate->exc_type = local_type;
           ^
utils/cython_bbox.c:6125:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’
     tstate->exc_value = local_value;
           ^
utils/cython_bbox.c:6126:11: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’
     tstate->exc_traceback = local_tb;
           ^
error: command 'gcc' failed with exit status 1
Compiling nms kernels by nvcc...
Including CUDA code.
/home/ubuntu/Detectron.pytorch/lib/model/nms
['/home/ubuntu/Detectron.pytorch/lib/model/nms/src/nms_cuda_kernel.cu.o']
generating /tmp/tmpsqbmpkvi/_nms.c
setting the current directory to '/tmp/tmpsqbmpkvi'
running build_ext
building '_nms' extension
creating home
creating home/ubuntu
creating home/ubuntu/Detectron.pytorch
creating home/ubuntu/Detectron.pytorch/lib
creating home/ubuntu/Detectron.pytorch/lib/model
creating home/ubuntu/Detectron.pytorch/lib/model/nms
creating home/ubuntu/Detectron.pytorch/lib/model/nms/src
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c _nms.c -o ./_nms.o -std=c99
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c /home/ubuntu/Detectron.pytorch/lib/model/nms/src/nms_cuda.c -o ./home/ubuntu/Detectron.pytorch/lib/model/nms/src/nms_cuda.o -std=c99
gcc -pthread -shared -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -L/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,-rpath=/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_nms.o ./home/ubuntu/Detectron.pytorch/lib/model/nms/src/nms_cuda.o /home/ubuntu/Detectron.pytorch/lib/model/nms/src/nms_cuda_kernel.cu.o -o ./_nms.so
Compiling roi pooling kernels by nvcc...
Including CUDA code.
/home/ubuntu/Detectron.pytorch/lib/model/roi_pooling
generating /tmp/tmptq2i62g6/_roi_pooling.c
setting the current directory to '/tmp/tmptq2i62g6'
running build_ext
building '_roi_pooling' extension
creating home
creating home/ubuntu
creating home/ubuntu/Detectron.pytorch
creating home/ubuntu/Detectron.pytorch/lib
creating home/ubuntu/Detectron.pytorch/lib/model
creating home/ubuntu/Detectron.pytorch/lib/model/roi_pooling
creating home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c _roi_pooling.c -o ./_roi_pooling.o -std=c99
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c /home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling.c -o ./home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling.o -std=c99
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c /home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling_cuda.c -o ./home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling_cuda.o -std=c99
gcc -pthread -shared -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -L/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,-rpath=/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_roi_pooling.o ./home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling.o ./home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling_cuda.o /home/ubuntu/Detectron.pytorch/lib/model/roi_pooling/src/roi_pooling.cu.o -o ./_roi_pooling.so
Compiling roi crop kernels by nvcc...
Including CUDA code.
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop
generating /tmp/tmpcd1yg2_m/_roi_crop.c
setting the current directory to '/tmp/tmpcd1yg2_m'
running build_ext
building '_roi_crop' extension
creating home
creating home/ubuntu
creating home/ubuntu/Detectron.pytorch
creating home/ubuntu/Detectron.pytorch/lib
creating home/ubuntu/Detectron.pytorch/lib/model
creating home/ubuntu/Detectron.pytorch/lib/model/roi_crop
creating home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c _roi_crop.c -o ./_roi_crop.o -std=c99
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c /home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c -o ./home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.o -std=c99
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c: In function ‘BilinearSamplerBHWD_updateGradInput’:
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:190:14: warning: unused variable ‘inBottomRight’ [-Wunused-variable]
         real inBottomRight=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:189:14: warning: unused variable ‘inBottomLeft’ [-Wunused-variable]
         real inBottomLeft=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:188:14: warning: unused variable ‘inTopRight’ [-Wunused-variable]
         real inTopRight=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:187:14: warning: unused variable ‘inTopLeft’ [-Wunused-variable]
         real inTopLeft=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:186:14: warning: unused variable ‘v’ [-Wunused-variable]
         real v=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c: In function ‘BilinearSamplerBCHW_updateGradInput’:
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:440:14: warning: unused variable ‘inBottomRight’ [-Wunused-variable]
         real inBottomRight=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:439:14: warning: unused variable ‘inBottomLeft’ [-Wunused-variable]
         real inBottomLeft=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:438:14: warning: unused variable ‘inTopRight’ [-Wunused-variable]
         real inTopRight=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:437:14: warning: unused variable ‘inTopLeft’ [-Wunused-variable]
         real inTopLeft=0;
              ^
/home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.c:436:14: warning: unused variable ‘v’ [-Wunused-variable]
         real v=0;
              ^
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c /home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop_cuda.c -o ./home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop_cuda.o -std=c99
gcc -pthread -shared -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -L/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,-rpath=/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_roi_crop.o ./home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop.o ./home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop_cuda.o /home/ubuntu/Detectron.pytorch/lib/model/roi_crop/src/roi_crop_cuda_kernel.cu.o -o ./_roi_crop.so
Compiling roi align kernels by nvcc...
Including CUDA code.
/home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align
generating /tmp/tmpythzjg8o/_roi_align.c
setting the current directory to '/tmp/tmpythzjg8o'
running build_ext
building '_roi_align' extension
creating home
creating home/ubuntu
creating home/ubuntu/Detectron.pytorch
creating home/ubuntu/Detectron.pytorch/lib
creating home/ubuntu/Detectron.pytorch/lib/modeling
creating home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom
creating home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align
creating home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align/src
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c _roi_align.c -o ./_roi_align.o -std=c99
gcc -pthread -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DWITH_CUDA -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/TH -I/home/ubuntu/anaconda3/envs/pytorch41/lib/python3.7/site-packages/torch/utils/ffi/../../lib/include/THC -I/usr/local/cuda/include -I/home/ubuntu/anaconda3/envs/pytorch41/include/python3.7m -c /home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align/src/roi_align_cuda.c -o ./home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align/src/roi_align_cuda.o -std=c99
gcc -pthread -shared -B /home/ubuntu/anaconda3/envs/pytorch41/compiler_compat -L/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,-rpath=/home/ubuntu/anaconda3/envs/pytorch41/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_roi_align.o ./home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align/src/roi_align_cuda.o /home/ubuntu/Detectron.pytorch/lib/modeling/roi_xfrom/roi_align/src/roi_align_kernel.cu.o -o ./_roi_align.so

System information

AiXiGua commented 5 years ago

@szrlee I have the same problem with you, did you figure out what's wrong?

carlosdcastillo commented 5 years ago

It is the version of Cython. You need to upgrade to Cython 0.29 and restart the compilation from scratch.

HolmesShuan commented 5 years ago

@AiXiGua @szrlee conda install cython if conda installed pip3 install --upgrade cython otherwise

Before rerunning bash make.sh, in my case, one should exit the current terminal and restart. It works for me (Python=3.7.0,Pytorch=0.4,Cython=0.29).

JiasiWang commented 5 years ago

@szrlee @AiXiGua @carlosdcastillo @HolmesShuan I have the same problem, and my python is 3.7, Cython is 0.29.2. Pythorch is 0.4.1 Could you please give some advices?

szrlee commented 5 years ago

@szrlee @AiXiGua @carlosdcastillo @HolmesShuan I have the same problem, and my python is 3.7, Cython is 0.29.2. Pythorch is 0.4.1 Could you please give some advices?

delete and recompile

JiasiWang commented 5 years ago

@szrlee @AiXiGua @carlosdcastillo @HolmesShuan I have the same problem, and my python is 3.7, Cython is 0.29.2. Pythorch is 0.4.1 Could you please give some advices?

delete and recompile

@szrlee I have delete the whole project, then down load and recompile again, but it does not work... Do you mean delete the project or I miss your point? Thanks

AiXiGua commented 5 years ago

@szrlee @AiXiGua @carlosdcastillo @HolmesShuan I have the same problem, and my python is 3.7, Cython is 0.29.2. Pythorch is 0.4.1 Could you please give some advices?

delete and recompile

@szrlee I have delete the whole project, then down load and recompile again, but it does not work... Do you mean delete the project or I miss your point? Thanks

Using python 3.5 is working for me.

JiasiWang commented 5 years ago

@szrlee @AiXiGua @carlosdcastillo @HolmesShuan I have the same problem, and my python is 3.7, Cython is 0.29.2. Pythorch is 0.4.1 Could you please give some advices?

delete and recompile

@szrlee I have delete the whole project, then down load and recompile again, but it does not work... Do you mean delete the project or I miss your point? Thanks

Using python 3.5 is working for me.

Yes, it does work! Thanks a lot!

AiXiGua commented 5 years ago

Well, this confirms my view that python3.7 is temporarily not supported, using python3.5 will solve the problem. @JiasiWang

szrlee commented 5 years ago

delete cython_nms.pyx and cython_bbox.pyx. then recompile would work for python 3.7.