PyTorch-Encoding icon indicating copy to clipboard operation
PyTorch-Encoding copied to clipboard

I get RuntimeError: Error building extension 'enclib_cpu':

Open Cverlpeng opened this issue 5 years ago • 12 comments

hi, I get this error, who can help me ? thanks!!!

Traceback (most recent call last): File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 946, in _build_extension_module check=True) File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/subprocess.py", line 418, 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 "train_nullmax.py", line 17, in import encoding.utils as utils File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/init.py", line 13, in from . import nn, functions, dilated, parallel, utils, models, datasets File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/nn/init.py", line 12, in from .encoding import * File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/nn/encoding.py", line 19, in from ..functions import scaledL2, aggregate, pairwise_cosine File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/functions/init.py", line 2, in from .encoding import * File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/functions/encoding.py", line 14, in from .. import lib File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/init.py", line 12, in ], build_directory=cpu_path, verbose=False) File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 645, in load is_python_module) File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 814, in _jit_compile with_cuda=with_cuda) File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 863, in _write_ninja_file_and_build _build_extension_module(name, build_directory, verbose) File "/home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 959, in build_extension_module raise RuntimeError(message) RuntimeError: Error building extension 'enclib_cpu': [1/3] c++ -MMD -MF roi_align_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/TH -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/THC -isystem /home/lpeng/anaconda3/envs/laneseg/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp -o roi_align_cpu.o FAILED: roi_align_cpu.o c++ -MMD -MF roi_align_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/TH -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/THC -isystem /home/lpeng/anaconda3/envs/laneseg/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp -o roi_align_cpu.o /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In function ‘at::Tensor ROIAlignForwardCPU(const at::Tensor&, const at::Tensor&, int64_t, int64_t, double, int64_t)’: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:407:30: error: ‘struct at::Type’ has no member named ‘tensor’ auto output = input.type().tensor({num_rois, channels, pooled_height, pooled_width}); ^ In file included from /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:9:0, from /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:1: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:27: error: expected primary-expression before ‘>’ token output.data<scalar_t>()); ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:29: error: expected primary-expression before ‘)’ token output.data<scalar_t>()); ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:27: error: expected primary-expression before ‘>’ token output.data<scalar_t>()); ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:425:29: error: expected primary-expression before ‘)’ token output.data<scalar_t>()); ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In function ‘at::Tensor ROIAlignBackwardCPU(const at::Tensor&, const at::Tensor&, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, double, int64_t)’: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:454:37: error: ‘struct at::Type’ has no member named ‘tensor’ auto grad_in = bottom_rois.type().tensor({b_size, channels, height, width}).zero(); ^ In file included from /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/ATen/ATen.h:9:0, from /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:1: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:28: error: expected primary-expression before ‘>’ token grad_in.data<scalar_t>(), ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:30: error: expected primary-expression before ‘)’ token grad_in.data<scalar_t>(), ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp: In lambda function: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:28: error: expected primary-expression before ‘>’ token grad_in.data<scalar_t>(), ^ /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:470:30: error: expected primary-expression before ‘)’ token grad_in.data<scalar_t>(), ^ [2/3] c++ -MMD -MF roi_align.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/TH -isystem /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/THC -isystem /home/lpeng/anaconda3/envs/laneseg/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align.cpp -o roi_align.o In file included from /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/encoding/lib/cpu/roi_align.cpp:1:0: /home/lpeng/anaconda3/envs/laneseg/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include/torch/torch.h:7:2: warning: #warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h" [-Wcpp] #warning
^ ninja: build stopped: subcommand failed.

image image image

Cverlpeng avatar Apr 10 '19 08:04 Cverlpeng

你尝试下torch =1.0.0

Gmgge avatar Apr 10 '19 09:04 Gmgge

Have you solved your problem? I meet the same problem.

tjulyz avatar Jun 15 '19 18:06 tjulyz

same problem

Dirtybluer avatar Jul 25 '19 09:07 Dirtybluer

same problem

Lydia-z avatar Aug 01 '19 08:08 Lydia-z

maybe it is usefull "https://zhuanlan.zhihu.com/p/53418563"

zyongbei avatar Aug 19 '19 08:08 zyongbei

same

Northzhangmingzhe avatar Oct 11 '19 01:10 Northzhangmingzhe

same

yemucong avatar Dec 10 '19 11:12 yemucong

FYI PyTorch has supported SyncBN officially. The author is not maintaining this repo and has moved to MXNet

StacyYang avatar Dec 10 '19 15:12 StacyYang

I also meet this problem. i have tried many version. No module named 'enclib_cpu' @tjulyz @zyongbei @Northzhangmingzhe @yemucong @StacyYang

qiaoyaya2011 avatar Jul 05 '20 10:07 qiaoyaya2011

Could you try the detailed steps here https://hangzhang.org/PyTorch-Encoding/notes/compile.html#detailed-steps

zhanghang1989 avatar Jul 05 '20 20:07 zhanghang1989

BTW, please use pytorch 1.4.0

zhanghang1989 avatar Jul 05 '20 20:07 zhanghang1989

I have solved my problem .

qiaoyaya2011 avatar Jul 17 '20 02:07 qiaoyaya2011