从源代码构建Pytorch [英] Build Pytorch from source

查看:193
本文介绍了从源代码构建Pytorch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从MacOS(版本10.14.3)上的源代码安装Pytorch以使用GPU.我已经从链接中获取了文档.在终端中启动MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install时,在终端中出现以下错误:

I'm trying to install Pytorch from source on my MacOS (version 10.14.3) to use GPU. I have follow the documentation from this link. When I launch in my terminal the MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install I'm getting the following error in my terminal:

[ 69%] Built target caffe2_observers make: *** [all] Error 2 Traceback (most recent
call last): File "setup.py", line 710, in <module>
build_deps() 
File "setup.py", line 282, in build_deps 
build_dir='build')
File "/Users/Desktop/pytorch/tools/build_pytorch_libs.py", line 259, in build_caffe2
check_call(['make', '-j', str(max_jobs), 'install'], cwd=build_dir, env=my_env)
File "/Users/anaconda3/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-j', '4', 'install']'
returned non-zero exit status 2.

我试图升级pip并重新安装anaconda和cuda,但没有成功.

I tried to upgrade pip and reinstall anaconda and cuda without success.

在这里您可以找到错误所在:

Here you can find the error just belong :

[ 69%] Building CXX object modules/observers/CMakeFiles/caffe2_observers.dir/net_observer_reporter_print.cc.o
In file included from <built-in>:1:
In file included from /usr/local/cuda/include/cuda_runtime.h:115:
In file included from /usr/local/cuda/include/crt/common_functions.h:77:
/Library/Developer/CommandLineTools/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
#include_next <string.h>
          ^~~~~~~~~~
1 error generated.
CMake Error at caffe2_gpu_generated_THCReduceApplyUtils.cu.o.Release.cmake:219 (message):
    Error generating
/Users/Desktop/pytorch/build/caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/./caffe2_gpu_generated_THCReduceApplyUtils.cu.o

make[2]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/caffe2_gpu_generated_THCReduceApplyUtils.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Scanning dependencies of target torch_shm_manager
1 error generated.

推荐答案

我遇到此问题是因为Nvidia与OSX Mojave 10.14+不兼容

I was encountering this problem because Nvidia is incompatible with OSX Mojave 10.14+

这篇关于从源代码构建Pytorch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆