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,

conda install numpy ninja pyyaml mkl mkl-include setuptools cmake cffi
conda install -c pytorch magma-cuda102
git clone --recursive https://github.com/pytorch/pytorch 1

cd pytorch
git checkout v0.4.1
git submodule sync
git submodule update --init --recursive
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/…/"}
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