Unable to install PyTorch from source - Performing Test SUPPORT_GLIBCXX_USE_C99 Failed

I am trying to install PyTorch from source but encounter an issue below. I followed the suggestion made by the output to visit https://github.com/pytorch/pytorch/issues/5229 which eventually led me to
https://medium.com/@Inoryy/compiling-pytorch-4-0-on-ubuntu-17-10-with-cuda-9-0-and-python-3-6-6769a0df56d5. The solution, however, requires me to do some installations that require the sudo command which I do not have access to since I am not the admin and so I was hoping to get some help here.

(attempt1) [haziqm2@nscc02 pytorch]$ python setup.py install
Building wheel torch-1.6.0a0+9da277c
-- Building version 1.6.0a0+9da277c
cmake -GNinja -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/users/astar/bmsi/haziqm2/pytorch/torch -DCMAKE_PREFIX_PATH=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1 -DNUMPY_INCLUDE_DIR=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/lib/python3.7/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/bin/python -DPYTHON_INCLUDE_DIR=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/include/python3.7m -DPYTHON_LIBRARY=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/lib/libpython3.7m.so.1.0 -DTORCH_BUILD_VERSION=1.6.0a0+9da277c -DUSE_NUMPY=True /home/users/astar/bmsi/haziqm2/pytorch
-- The CXX compiler identification is GNU 4.4.7
-- The C compiler identification is GNU 4.4.7
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Not forcing any particular BLAS to be found
-- Performing Test COMPILER_WORKS
-- Performing Test COMPILER_WORKS - Success
-- Performing Test SUPPORT_GLIBCXX_USE_C99
-- Performing Test SUPPORT_GLIBCXX_USE_C99 - Failed
CMake Error at cmake/MiscCheck.cmake:81 (message):
  The C++ compiler does not support required functions.  This is very likely
  due to a known bug in GCC 5 (and maybe other versions) on Ubuntu 17.10 and
  newer.  For more information, see:
  https://github.com/pytorch/pytorch/issues/5229
Call Stack (most recent call first):
  CMakeLists.txt:458 (include)


-- Configuring incomplete, errors occurred!
See also "/home/users/astar/bmsi/haziqm2/pytorch/build/CMakeFiles/CMakeOutput.log".
See also "/home/users/astar/bmsi/haziqm2/pytorch/build/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
  File "setup.py", line 732, in <module>
    build_deps()
  File "setup.py", line 316, in build_deps
    cmake=cmake)
  File "/home/users/astar/bmsi/haziqm2/pytorch/tools/build_pytorch_libs.py", line 59, in build_caffe2
    rerun_cmake)
  File "/home/users/astar/bmsi/haziqm2/pytorch/tools/setup_helpers/cmake.py", line 329, in generate
    self.run(args, env=my_env)
  File "/home/users/astar/bmsi/haziqm2/pytorch/tools/setup_helpers/cmake.py", line 141, in run
    check_call(command, cwd=self.build_dir, env=env)
  File "/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '-GNinja', '-DBUILD_PYTHON=True', '-DBUILD_TEST=True', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_INSTALL_PREFIX=/home/users/astar/bmsi/haziqm2/pytorch/torch', '-DCMAKE_PREFIX_PATH=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1', '-DNUMPY_INCLUDE_DIR=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/lib/python3.7/site-packages/numpy/core/include', '-DPYTHON_EXECUTABLE=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/bin/python', '-DPYTHON_INCLUDE_DIR=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/include/python3.7m', '-DPYTHON_LIBRARY=/home/users/astar/bmsi/haziqm2/anaconda3/envs/attempt1/lib/libpython3.7m.so.1.0', '-DTORCH_BUILD_VERSION=1.6.0a0+9da277c', '-DUSE_NUMPY=True', '/home/users/astar/bmsi/haziqm2/pytorch']' returned non-zero exit status 1.
(attempt1) [haziqm2@nscc02 pytorch]$

Would you be able to use docker containers, as it might be the easiest workaround, if you cannot install anything on your machine?
This would allow you to use a newer Ubuntu and GCC version, which should work.