When I run python.exe -m pip install git+https://github.com/facebookresearch/detectron2.git
from a folder containing python.exe
I get ModuleNotFoundError: No module named 'torch'
.
However, torch imports normally:
C:\Python310>python.exe
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.3.0+cu121'
How to install detectron2
?
The docs states that detectron2
requires:
Linux or macOS with Python ≥ 3.7
PyTorch ≥ 1.8 and torchvision that matches the PyTorch installation. Install them together at pytorch.org to make sure of this.
OpenCV is optional but needed by demo and visualization
There's no apparent support for this package on Windows Machines. You can either find a similar package that supports Windows or install Windows Subsystem for Linux (WSL) which provides a Linux environment on your Windows machines. After getting WSL, you can then install this package in that environment.