zhanghang1989 / PyTorch-Encoding

A CV toolkit for my papers.
https://hangzhang.org/PyTorch-Encoding/
MIT License
2.04k stars 450 forks source link

problems for import encoding #197

Closed mathser123 closed 3 years ago

mathser123 commented 5 years ago

when import encoding,I have the error


**CalledProcessError Traceback (most recent call last) ~/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _build_extension_module(name, build_directory, verbose) 948 cwd=build_directory, --> 949 check=True) 950 else:

~/anaconda3/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs) 437 raise CalledProcessError(retcode, process.args, --> 438 output=stdout, stderr=stderr) 439 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

RuntimeError Traceback (most recent call last)

in () ----> 1 import encoding ~/anaconda3/lib/python3.6/site-packages/encoding/__init__.py in () 11 """An optimized PyTorch package with CUDA backend.""" 12 from .version import __version__ ---> 13 from . import nn, functions, dilated, parallel, utils, models, datasets ~/anaconda3/lib/python3.6/site-packages/encoding/nn/__init__.py in () 10 11 """Encoding NN Modules""" ---> 12 from .encoding import * 13 from .syncbn import * 14 from .customize import * ~/anaconda3/lib/python3.6/site-packages/encoding/nn/encoding.py in () 16 from torch.nn.modules.utils import _pair 17 ---> 18 from ..functions import scaled_l2, aggregate, pairwise_cosine 19 20 __all__ = ['Encoding', 'EncodingDrop', 'Inspiration', 'UpsampleConv2d'] ~/anaconda3/lib/python3.6/site-packages/encoding/functions/__init__.py in () 1 """Encoding Autograd Fuctions""" ----> 2 from .encoding import * 3 from .syncbn import * 4 from .customize import * ~/anaconda3/lib/python3.6/site-packages/encoding/functions/encoding.py in () 12 from torch.autograd import Function, Variable 13 import torch.nn.functional as F ---> 14 from .. import lib 15 16 __all__ = ['aggregate', 'scaled_l2', 'pairwise_cosine'] ~/anaconda3/lib/python3.6/site-packages/encoding/lib/__init__.py in () 13 os.path.join(cpu_path, 'roi_align_cpu.cpp'), 14 os.path.join(cpu_path, 'nms_cpu.cpp'), ---> 15 ], build_directory=cpu_path, verbose=False) 16 17 if torch.cuda.is_available(): ~/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module) 642 verbose, 643 with_cuda, --> 644 is_python_module) 645 646 ~/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _jit_compile(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module) 811 build_directory=build_directory, 812 verbose=verbose, --> 813 with_cuda=with_cuda) 814 finally: 815 baton.release() ~/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _write_ninja_file_and_build(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda) 864 if verbose: 865 print('Building extension module {}...'.format(name)) --> 866 _build_extension_module(name, build_directory, verbose) 867 868 ~/anaconda3/lib/python3.6/site-packages/torch/utils/cpp_extension.py in _build_extension_module(name, build_directory, verbose) 960 if hasattr(error, 'output') and error.output: 961 message += ": {}".format(str(error.output)) --> 962 raise RuntimeError(message) 963 964 RuntimeError: Error building extension 'enclib_cpu': b'[1/4] c++ -MMD -MF syncbn_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/THC -isystem /home/ubuntu/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/syncbn_cpu.cpp -o syncbn_cpu.o\nFAILED: syncbn_cpu.o \nc++ -MMD -MF syncbn_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/THC -isystem /home/ubuntu/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/syncbn_cpu.cpp -o syncbn_cpu.o\n/home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/syncbn_cpu.cpp:1:10: fatal error: torch/tensor.h: \xe6\xb2\xa1\xe6\x9c\x89\xe9\x82\xa3\xe4\xb8\xaa\xe6\x96\x87\xe4\xbb\xb6\xe6\x88\x96\xe7\x9b\xae\xe5\xbd\x95\n #include \n ^~~~~~~~~~~~~~~~\ncompilation terminated.\n[2/4] c++ -MMD -MF roi_align_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/THC -isystem /home/ubuntu/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp -o roi_align_cpu.o\nFAILED: roi_align_cpu.o \nc++ -MMD -MF roi_align_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/THC -isystem /home/ubuntu/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp -o roi_align_cpu.o\n/home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/roi_align_cpu.cpp:1:10: fatal error: torch/tensor.h: \xe6\xb2\xa1\xe6\x9c\x89\xe9\x82\xa3\xe4\xb8\xaa\xe6\x96\x87\xe4\xbb\xb6\xe6\x88\x96\xe7\x9b\xae\xe5\xbd\x95\n #include \n ^~~~~~~~~~~~~~~~\ncompilation terminated.\n[3/4] c++ -MMD -MF nms_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/THC -isystem /home/ubuntu/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/nms_cpu.cpp -o nms_cpu.o\nFAILED: nms_cpu.o \nc++ -MMD -MF nms_cpu.o.d -DTORCH_EXTENSION_NAME=enclib_cpu -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/TH -isystem /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/include/THC -isystem /home/ubuntu/anaconda3/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/nms_cpu.cpp -o nms_cpu.o\n/home/ubuntu/anaconda3/lib/python3.6/site-packages/encoding/lib/cpu/nms_cpu.cpp:1:10: fatal error: torch/tensor.h: \xe6\xb2\xa1\xe6\x9c\x89\xe9\x82\xa3\xe4\xb8\xaa\xe6\x96\x87\xe4\xbb\xb6\xe6\x88\x96\xe7\x9b\xae\xe5\xbd\x95\n #include \n ^~~~~~~~~~~~~~~~\ncompilation terminated.\nninja: build stopped: subcommand failed.\n'** ===========================================================================j pytorch =1.1.0 cuda=10.0 ninja=1.8.2 ubuntu=18.04 i used to install pytorch=1.0.0 cuda=9.0 but the problem still
tjulyz commented 5 years ago

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

bohanzhuang commented 5 years ago

I installed pytorch v1.0.0 from scratch and met the same problem.

qianyizhang commented 5 years ago

any updates? it seems theres breaking change in compliation since pytorch 1.0

dayekuaipao commented 5 years ago

I met the same problem too

zhanghang1989 commented 4 years ago

It should be fixed in the newest version.

mathser123 commented 3 years ago

I have finished it. We should follow writer's version completely.