Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install Detectron2 on Windows 10 #5

Closed
JonathanSamelson opened this issue Jun 2, 2022 · 0 comments
Closed

Install Detectron2 on Windows 10 #5

JonathanSamelson opened this issue Jun 2, 2022 · 0 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@JonathanSamelson
Copy link
Collaborator

JonathanSamelson commented Jun 2, 2022

This issue reports how to install Detectron2 on Windows 10, based on my previous experience.

Prerequisites

  • Install Visual Studio Community 2019 with Desktop development with C++
  • Install Visual C++ 2015 build tools
  • Ensure Microsoft Visual C++ Redistributable are installed. If not, install them from here

Note that all were maybe not necessary but they were all installed at the time the installation of Detectron2 worked.

Additionally, you'd like to add these to your PATH system variable:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\Hostx64\
  • C:\Program Files (x86)\Windows Kits\10\bin\10.VERSION\x86 where VERSION is the latest version available

Installation

Open a prompt in your conda environment (e.g. apt_tb) and type the following commands :

pip install cython
pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
git clone https://github.com/facebookresearch/detectron2.git
cd detectron2
git checkout tags/v0.6
cd ..

Then, open the file setup.py in detectron2 and change the following, starting at line 72:

        if not is_rocm_pytorch:
            define_macros += [("WITH_CUDA", None)]
            extra_compile_args["nvcc"] = [
                "-O3",
                "-DCUDA_HAS_FP16=1",
                "-D__CUDA_NO_HALF_OPERATORS__",
                "-D__CUDA_NO_HALF_CONVERSIONS__",
                "-D__CUDA_NO_HALF2_OPERATORS__"
            ]

to

        if not is_rocm_pytorch:
            define_macros += [("WITH_CUDA", None)]
            extra_compile_args["nvcc"] = [
                "-O3",
                "-DCUDA_HAS_FP16=1",
                "-D__CUDA_NO_HALF_OPERATORS__",
                "-D__CUDA_NO_HALF_CONVERSIONS__",
                "-D__CUDA_NO_HALF2_OPERATORS__",
                "-DWITH_CUDA"
            ]

Eventually, finish the installation by typing this command in your prompt:

pip install -e detectron2

Hopefully, Detectron2 should be successfully installed.

@JonathanSamelson JonathanSamelson added the documentation Improvements or additions to documentation label Jun 2, 2022
@JonathanSamelson JonathanSamelson self-assigned this Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant