Detectron2 + PyTorch CPU
❌ The error
$ pip install -q --extra-index-url https://download.pytorch.org/whl/cpu torch torchvision
$ pip install --extra-index-url https://download.pytorch.org/whl/cpu \
"git+https://github.com/facebookresearch/detectron2.git"
Collecting git+https://github.com/facebookresearch/detectron2.git
Cloning https://github.com/facebookresearch/detectron2.git ...
Running command git clone --filter=blob:none ...
Resolved https://github.com/facebookresearch/detectron2.git to commit d38d716...
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
...
ModuleNotFoundError: No module named 'torch'
[end of output]
✅ The solution
pip install --no-build-isolation \
--extra-index-url https://download.pytorch.org/whl/cpu \
"git+https://github.com/facebookresearch/detectron2.git"
Why it works
--no-build-isolation
tells pip to reuse the packages already in your virtual-env instead of creating a fresh, empty build sandbox.