xuancong84 / install-PyTorch-on-Android

How to install PyTorch on Android smartphone (without CUDA)
41 stars 1 forks source link

pytorch build crash #2

Open octavianmm opened 4 years ago

octavianmm commented 4 years ago

Hi,

I'm trying to build pytorch v1.4.1 however the build process crashes with the following: `[ 51%] Building CXX object caffe2/CMakeFiles/torch.dir/opt/onnxifi_op.cc.o In file included from /root/pytorch/c10/core/CPUAllocator.h:7, from /root/pytorch/caffe2/core/allocator.h:3, from /root/pytorch/caffe2/core/context.h:9, from /root/pytorch/caffe2/opt/onnxifi_op.h:8, from /root/pytorch/caffe2/opt/onnxifi_op.cc:1: /root/pytorch/caffe2/opt/onnxifi_op.h: In instantiation of ‘void caffe2::OnnxifiOp::buildBackendAndGraph(caffe2::Workspace, const std::vector<long unsigned int, std::allocator >&, const string&) [with Context = caffe2::CPUContext; std::string = std::__cxx11::basic_string]’: /root/pytorch/caffe2/opt/onnxifi_op.h:124:5: required from ‘caffe2::OnnxifiOp::OnnxifiOp(const caffe2::OperatorDef&, caffe2::Workspace) [with Context = caffe2::CPUContext]’ /root/pytorch/c10/util/Registry.h:184:26: required from ‘static ObjectPtrType c10::Registerer<SrcType, ObjectPtrType, Args>::DefaultCreator(Args ...) [with DerivedType = caffe2::OnnxifiOp; SrcType = std::__cxx11::basic_string; ObjectPtrType = std::unique_ptr; Args = {const caffe2::OperatorDef&, caffe2::Workspace}]’ /root/pytorch/caffe2/opt/onnxifi_op.cc:436:1: required from here /root/pytorch/caffe2/opt/onnxifi_op.h:259:15: error: invalid conversion from ‘caffe2::Blob’ to ‘uint32_t’ {aka ‘unsigned int’} [-fpermissive] 259 defered_blob_reader), ^~~~~~~
caffe2::Blob*

/root/pytorch/c10/util/Logging.h:207:61: note: in definition of macro ‘CAFFE_ENFORCE_THAT_IMPL’ 207 | const EnforceFailMessage& CAFFE_ENFORCE_THAT_IMPLr = (condition); \ | ^~~~~ /root/pytorch/caffe2/opt/onnxifi_op.h:250:7: note: in expansion of macro ‘CAFFE_ENFORCE_EQ’ 250 | CAFFE_ENFORCE_EQ( | ^~~~ /root/pytorch/c10/util/Logging.h:239:33: error: too few arguments to function 239 | CAFFE_ENFORCE_THAT_IMPL(Equals((x), (y)), #x " == " #y, __VA_ARGS) | ^ /root/pytorch/c10/util/Logging.h:207:61: note: in definition of macro ‘CAFFE_ENFORCE_THAT_IMPL’ 207 | const EnforceFailMessage& CAFFE_ENFORCE_THAT_IMPLr = (condition); \ | ^~~~~ /root/pytorch/caffe2/opt/onnxifi_op.h:250:7: note: in expansion of macro ‘CAFFE_ENFORCE_EQ’ 250 | CAFFE_ENFORCE_EQ( | ^~~~ In file included from /usr/include/c++/9/functional:59, from /root/pytorch/c10/core/DeviceType.h:11, from /root/pytorch/c10/core/Device.h:3, from /root/pytorch/c10/core/Allocator.h:6, from /root/pytorch/c10/core/CPUAllocator.h:6, from /root/pytorch/caffe2/core/allocator.h:3, from /root/pytorch/caffe2/core/context.h:9, from /root/pytorch/caffe2/opt/onnxifi_op.h:8, from /root/pytorch/caffe2/opt/onnxifi_op.cc:1: /usr/include/c++/9/bits/std_function.h:667:7: error: ‘std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = caffe2::OnnxifiOp::buildBackendAndGraph(caffe2::Workspace*, const std::vector<long unsigned int, std::allocator >&, const string&) [with Context = caffe2::CPUContext; std::string = std::cxx11::basic_string]::<lambda()>; = void; = void; _Res = std::shared_ptr; _ArgTypes = {}]’, declared using local type ‘caffe2::OnnxifiOp::buildBackendAndGraph(caffe2::Workspace*, const std::vector<long unsigned int, std::allocator >&, const string&) [with Context = caffe2::CPUContext; std::string = std::__cxx11::basic_string]::<lambda()>’, is used but never defined [-fpermissive] 667 | function<_Res(_ArgTypes...)>:: | ^~~~~~~~ make[2]: [caffe2/CMakeFiles/torch.dir/build.make:8728: caffe2/CMakeFiles/torch.dir/opt/onnxifi_op.cc.o] Error 1 make[1]: [CMakeFiles/Makefile2:6881: caffe2/CMakeFiles/torch.dir/all] Error 2 make: *** [Makefile:141: all] Error 2 Traceback (most recent call last): File "setup.py", line 755, in build_deps() File "setup.py", line 311, in build_deps build_caffe2(version=version, File "/root/pytorch/tools/build_pytorch_libs.py", line 62, in build_caffe2 cmake.build(my_env) File "/root/pytorch/tools/setup_helpers/cmake.py", line 335, in build self.run(build_args, my_env) File "/root/pytorch/tools/setup_helpers/cmake.py", line 141, in run check_call(command, cwd=self.build_dir, env=env) File "/usr/lib/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'install', '--config', 'Release', '--', '-j', '1']' returned non-zero exit status 2. `

I tried with python3.8 and python 2.7. I didn't manage to install python3.6 on termux-ubuntu - it installs 3.8 by default when running apt install python3

Any hints on the above error?

Thanks.

xuancong84 commented 4 years ago

I remember my python3.8 build PyTorch 1.4.1 also stucks here. These kind of build failures always happen. You need to poke here and there in order to make it work ^_^

AnnieJohnson25 commented 3 years ago

Hey, I faced this problem too. What should we be looking at to fix this? Is it the setup.py program that we must alter?

bubbelbadHD commented 1 year ago

how did you guys solve this problem there is no solution for this on the internet are some packages that need to be installed?

AnnieJohnson25 commented 1 year ago

This repository helped me install pytorch : https://github.com/KumaTea/pytorch-aarch64. You could try it out.