Detectron2 on windows

Muhammad4hmed: <p>Hi, I’m trying to install detectron on my windows, here is what I have tried:</p>
<p>My pytorch version is: 1.5.1+cpu and torchvision is 0.6.1+cpu.<br>
First of all, I installed pycocotools from <a href="https://pypi.org/project/pycocotools-windows/" rel="noopener nofollow ugc">https://pypi.org/project/pycocotools-windows/</a><br>
then cloned the detectron2 from <a href="https://github.com/DGMaxime/detectron2-windows" rel="noopener nofollow ugc">https://github.com/DGMaxime/detectron2-windows</a><br>
and then ran the setup</p>
<pre><code class="lang-auto">cd detectron2-windows
pip install -e .
</code></pre>
<p>But getting the following error:</p>
<pre><code class="lang-auto">Running setup.py 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\\setup.py'"'"'; __file__='"'"'C:\\Users\\Retrocausal\\detectron2-windows\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\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\cpp_extension.py:305: 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\cpp_extension.py:238: 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": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    Error in atexit._run_exitfuncs:
    Traceback (most recent call last):
      File "C:\Users\Retrocausal\Anaconda3\lib\site-packages\colorama\ansitowin32.py", 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\\setup.py'"'"'; __file__='"'"'C:\\Users\\Retrocausal\\detectron2-windows\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.
</code></pre>
<p>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.</p>

mobassir94: <p>follow this discussion carefully : <a href="https://github.com/markstrefford/running-detectron2-on-windows-wsl2-rtx30xx/issues/2" class="inline-onebox" rel="noopener nofollow ugc">yml file isn't working(CondaEnvException: Pip failed) · Issue #2 · markstrefford/running-detectron2-on-windows-wsl2-rtx30xx · GitHub</a></p>
<p>you will get to know how i installed detectron2 in windows successfully using rtx 3060ti,thanks</p>

solarflarefx: <p><a class="mention" href="/u/mobassir94">@mobassir94</a> Are you running detectron2 using the CPU or GPU on Windows?</p>

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