RuntimeError: Error compiling objects for extension while installing detectron2

I’m trying to install detectron2 on my local machine. A cpp_extension.py located in

C:\Users\Tomi\miniconda3\envs\pytorch_env\lib\site-packages\torch\utils\cpp_extension.py

fails to compile and throws a

raise RuntimeError(message) from e
    RuntimeError: Error compiling objects for extension

I just finished installing the tensorflow object detection API so I have pycocotools and other c++ build tools required. Are there more extensions of c++ tools I would have to install?

OS: windows
Visual Studio tools installed: 2015 and 2019 build tools, windows 10 sdk, windows universal crt and crt sdk
pytorch version: 1.12.1

command leading to error:
python -m pip install -e detectron2