PyTorch needs CUDA>=10.2 right now while you are using 9.1, which is thus breaking with:
CMake Error at cmake/public/cuda.cmake:440 (message):
  CUDA 9.1 is not compatible with std::tuple from GCC version >= 6.  Please
  upgrade to CUDA 9.2 or set the following environment variable to use
  another version (for example)