Yes,
deleting theCMakeCache.txt worked but then I got myriads of other errors which were just becoming too much overwhelming then I tried hard to install conda which worked eventually but now I am not able to install pytorch via source using conda