Can't install PyTorch0.4.1 From Source

username: Muhammad_Maaz
cooked: <p>I am trying to build Pytorch0.4.1 from the source on my Ubuntu18.04 desktop PC. The environment details are as follows,</p>
<ul>
<li>OS: Ubuntu 18.04</li>
<li>GPU: RTX 2080 Supper</li>
<li>CUDA: 10.2</li>
<li>Anaconda Environment with Python 3.6</li>
</ul>
<p>I used the following commands to install Pytorch from source,</p>
<ol>
<li>conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi</li>
<li>conda install -c pytorch magma-cuda102</li>
<li>git clone --recursive <a href="https://github.com/pytorch/pytorch" rel="nofollow noopener">https://github.com/pytorch/pytorch</a>
</li>
<li>cd pytorch</li>
<li>git checkout v0.4.1</li>
<li>git submodule sync</li>
<li>git submodule update --init --recursive</li>
<li>export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/…/"}</li>
<li>python setup.py install</li>
</ol>
<p>I am getting the following error<br>
CMakeFiles/Makefile2:923: recipe for target ‘caffe2/CMakeFiles/caffe2_gpu.dir/all’ failed<br>
make[1]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/all] Error 2<br>
Makefile:140: recipe for target ‘all’ failed<br>
make: *** [all] Error 2<br>
Failed to run ‘bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack nccl caffe2 nanopb libshm gloo THD c10d’</p>
<p>Any workaround? Thanks</p>

username: ptrblck
cooked: <p>Could you check the complete log for another preceding error message?<br>
The posted log does only show the failure, but usually you should see some errors before that.</p>

username: Muhammad_Maaz
cooked: <p>Hi <a class="mention" href="/u/ptrblck">@ptrblck</a>,</p>
<p>Here are the complete logs.</p>
<p>[ 71%] Building NVCC (Device) object caffe2/CMakeFiles/caffe2_gpu.dir/__/aten/src/THC/generated/caffe2_gpu_generated_THCTensorMathCompareTByte.cu.o<br>
/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</p>
<p>/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</p>
<p>2 errors detected in the compilation of “/tmp/tmpxft_00006653_00000000-6_THCTensorScatterGather.cpp1.ii”.<br>
CMake Error at caffe2_gpu_generated_THCTensorScatterGather.cu.o.Release.cmake:279 (message):<br>
Error generating file<br>
/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</p>
<p>caffe2/CMakeFiles/caffe2_gpu.dir/build.make:9994: recipe for target 'caffe2/CMakeFiles/caffe2_gpu.dir/<strong>/aten/src/THC/caffe2_gpu_generated_THCTensorScatterGather.cu.o’ failed<br>
make[2]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/</strong>/aten/src/THC/caffe2_gpu_generated_THCTensorScatterGather.cu.o] Error 1<br>
make[2]: *** Waiting for unfinished jobs…<br>
/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</p>
<p>/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</p>
<p>2 errors detected in the compilation of “/tmp/tmpxft_00006699_00000000-6_THCTensorIndex.cpp1.ii”.<br>
CMake Error at caffe2_gpu_generated_THCTensorIndex.cu.o.Release.cmake:279 (message):<br>
Error generating file<br>
/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</p>
<p>caffe2/CMakeFiles/caffe2_gpu.dir/build.make:8536: recipe for target 'caffe2/CMakeFiles/caffe2_gpu.dir/<strong>/aten/src/THC/caffe2_gpu_generated_THCTensorIndex.cu.o’ failed<br>
make[2]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/</strong>/aten/src/THC/caffe2_gpu_generated_THCTensorIndex.cu.o] Error 1<br>
CMakeFiles/Makefile2:923: recipe for target ‘caffe2/CMakeFiles/caffe2_gpu.dir/all’ failed<br>
make[1]: *** [caffe2/CMakeFiles/caffe2_gpu.dir/all] Error 2<br>
Makefile:140: recipe for target ‘all’ failed<br>
make: *** [all] Error 2<br>
Failed to run ‘bash tools/build_pytorch_libs.sh --use-cuda --use-nnpack nccl caffe2 nanopb libshm gloo THD c10d’</p>

username: Muhammad_Maaz
cooked: <p>Moreover, I also tried building PyTorch0.4.1 with Cuda10.0, and same error occurred. Looking forward to hearing from you.</p>

username: ptrblck
cooked: <p>Thanks for the logs. The issue seems to have been solved in this <a href="https://github.com/pytorch/pytorch/issues/38193#issuecomment-626374780">cross-post</a>.</p>