Detectron2 on windows

Hi, I’m trying to install detectron on my windows, here is what I have tried:

My pytorch version is: 1.5.1+cpu and torchvision is 0.6.1+cpu.
First of all, I installed pycocotools from
then cloned the detectron2 from
and then ran the setup

cd detectron2-windows
pip install -e .

But getting the following error:

Running develop for detectron2
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Retrocausal\Anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Retrocausal\\detectron2-windows\\'"'"'; __file__='"'"'C:\\Users\\Retrocausal\\detectron2-windows\\'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: C:\Users\Retrocausal\detectron2-windows\
    Complete output (22 lines):
    running develop
    running egg_info
    creating detectron2.egg-info
    writing detectron2.egg-info\PKG-INFO
    writing dependency_links to detectron2.egg-info\dependency_links.txt
    writing requirements to detectron2.egg-info\requires.txt
    writing top-level names to detectron2.egg-info\top_level.txt
    writing manifest file 'detectron2.egg-info\SOURCES.txt'
    reading manifest file 'detectron2.egg-info\SOURCES.txt'
    writing manifest file 'detectron2.egg-info\SOURCES.txt'
    running build_ext
    building 'detectron2._C' extension
    C:\Users\Retrocausal\Anaconda3\lib\site-packages\torch\utils\ UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
      warnings.warn(msg.format('we could not find ninja.'))
    C:\Users\Retrocausal\Anaconda3\lib\site-packages\torch\utils\ UserWarning: Error checking compiler version for cl: [WinError 2] The system cannot find the file specified
      warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
    Error in atexit._run_exitfuncs:
    Traceback (most recent call last):
      File "C:\Users\Retrocausal\Anaconda3\lib\site-packages\colorama\", line 59, in closed
        return stream.closed
    ValueError: underlying buffer has been detached
ERROR: Command errored out with exit status 1: 'C:\Users\Retrocausal\Anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Retrocausal\\detectron2-windows\\'"'"'; __file__='"'"'C:\\Users\\Retrocausal\\detectron2-windows\\'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);'"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

I have followed a few tutorial on internet regarding installation of detectron2 but none of them worked have spent almost 2 weeks on this, Kindly guide regarding this. Thanks.

follow this discussion carefully : yml file isn't working(CondaEnvException: Pip failed) · Issue #2 · markstrefford/running-detectron2-on-windows-wsl2-rtx30xx · GitHub

you will get to know how i installed detectron2 in windows successfully using rtx 3060ti,thanks

@mobassir94 Are you running detectron2 using the CPU or GPU on Windows?

i didn’t train anything on gpu using detectron2,but i was able to import detectron2 and also this import :
from detectron2 import _C
i guess as i didn’t get any error,means i can use both cpu and gpu