首页 > 解决方案 > 从源代码编译 PyTorch 1.10.0

问题描述

我一直在尝试从源代码安装新版本的 PyTorch (1.10.0)。我已按照PyTorch 团队的指示进行操作。

工具/库/操作系统版本:gcc 8.3、Python 3.7.6(推荐)、Cuda 11.0、PyTorch 1.10.0、Linux RedHat

关于 gcc 的版本,我知道其他人使用 8.3 版本并安装 PyTorch 1.9.0 是成功的。

整个脚本如下:

conda install -c anaconda cudatoolkit
conda install astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses
conda install -c pytorch magma-cuda110

module load gcc/8.3 #version of gcc


git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
git checkout v1.10.0

USE_CUDA=1
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
git submodule update --recursive
python setup.py install

conda install -c conda-forge freetype jpeg lcms2 libmklml libpng libtiff libwebp-base olefile openjpeg pillow typing-extensions ffmpeg

git clone --recursive https://github.com/pytorch/vision
cd vision
python setup.py install
 

一些警告引起了我的注意:

CMake Warning at caffe2/CMakeLists.txt:1748 (add_executable):
  Cannot generate a safe runtime search path for target backend_fallback_test
  because there is a cycle in the constraint graph:

    dir 0 is [.../miniconda3/envs/pyts/lib]
      dir 2 must precede it due to runtime library [libcudart.so.11.0]
    dir 1 is [.../pytorch/build/lib]
    dir 2 is [/usr/local/cuda/lib64]
      dir 0 must precede it due to runtime library [libnvToolsExt.so.1]

  Some of these libraries may not be found correctly.

经过几次尝试,错误是这样的:

[6432/6692] Building CXX object caffe2....dir/csrc/jit/python/script_init.cpp.o
ninja: build stopped: subcommand failed.

有什么提示吗?谢谢你。

标签: compiler-errorspytorch

解决方案


推荐阅读