Can't install PyTorch0.4.1 From Source

I am trying to build Pytorch0.4.1 from the source on my Ubuntu18.04 desktop PC. The environment details are as follows,

  • OS: Ubuntu 18.04
  • GPU: RTX 2080 Supper
  • CUDA: 10.2
  • Anaconda Environment with Python 3.6

I used the following commands to install Pytorch from source,

  1. conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi
  2. conda install -c pytorch magma-cuda102
  3. git clone --recursive https://github.com/pytorch/pytorch
  4. cd pytorch
  5. git checkout v0.4.1
  6. git submodule sync
  7. git submodule update --init --recursive
  8. export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/…/"}
  9. python setup.py install

I am getting the following error
CMakeFiles/Makefile2:923: recipe for target ‘caffe2/CMakeFiles/caffe2_gpu.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
make: *** [all] Error 2
Failed to run ‘bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack nccl caffe2 nanopb libshm gloo THD c10d’

Any workaround? Thanks

Could you check the complete log for another preceding error message?
The posted log does only show the failure, but usually you should see some errors before that.

Hi @ptrblck,

Here are the complete logs.

[ 71%] Building NVCC (Device) object caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/generated/caffe2_gpu_generated_THCTensorMathCompareTByte.cu.o
/home/maaz/mmaaz60/pytorch_from_source/pytorch-0.4.1/aten/src/THC/THCAtomics.cuh(100): error: cannot overload functions distinguished by return type alone

/home/maaz/mmaaz60/pytorch_from_source/pytorch-0.4.1/aten/src/THC/THCAtomics.cuh(123): error: return value type does not match the function type

2 errors detected in the compilation of “/tmp/tmpxft_00006653_00000000-6_THCTensorScatterGather.cpp1.ii”.
CMake Error at caffe2_gpu_generated_THCTensorScatterGather.cu.o.Release.cmake:279 (message):
Error generating file
/home/maaz/mmaaz60/pytorch_from_source/pytorch-0.4.1/build/caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/./caffe2_gpu_generated_THCTensorScatterGather.cu.o

caffe2/CMakeFiles/caffe2_gpu.dir/build.make:9994: recipe for target 'caffe2/CMakeFiles/caffe2_gpu.dir//aten/src/THC/caffe2_gpu_generated_THCTensorScatterGather.cu.o’ failed
make[2]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/
/aten/src/THC/caffe2_gpu_generated_THCTensorScatterGather.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs…
/home/maaz/mmaaz60/pytorch_from_source/pytorch-0.4.1/aten/src/THC/THCAtomics.cuh(100): error: cannot overload functions distinguished by return type alone

/home/maaz/mmaaz60/pytorch_from_source/pytorch-0.4.1/aten/src/THC/THCAtomics.cuh(123): error: return value type does not match the function type

2 errors detected in the compilation of “/tmp/tmpxft_00006699_00000000-6_THCTensorIndex.cpp1.ii”.
CMake Error at caffe2_gpu_generated_THCTensorIndex.cu.o.Release.cmake:279 (message):
Error generating file
/home/maaz/mmaaz60/pytorch_from_source/pytorch-0.4.1/build/caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/./caffe2_gpu_generated_THCTensorIndex.cu.o

caffe2/CMakeFiles/caffe2_gpu.dir/build.make:8536: recipe for target 'caffe2/CMakeFiles/caffe2_gpu.dir//aten/src/THC/caffe2_gpu_generated_THCTensorIndex.cu.o’ failed
make[2]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/
/aten/src/THC/caffe2_gpu_generated_THCTensorIndex.cu.o] Error 1
CMakeFiles/Makefile2:923: recipe for target ‘caffe2/CMakeFiles/caffe2_gpu.dir/all’ failed
make[1]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/all] Error 2
Makefile:140: recipe for target ‘all’ failed
make: *** [all] Error 2
Failed to run ‘bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack nccl caffe2 nanopb libshm gloo THD c10d’

Moreover, I also tried building PyTorch0.4.1 with Cuda10.0, and same error occurred. Looking forward to hearing from you.

Thanks for the logs. The issue seems to have been solved in this cross-post.