facebookresearch / detectron2

Detectron2 is a platform for object detection, segmentation and other visual recognition tasks.
https://detectron2.readthedocs.io/en/latest/
Apache License 2.0
29.32k stars 7.32k forks source link

Detectron doesn't include torch as a formal dependency #5228

Open mdvthu opened 4 months ago

mdvthu commented 4 months ago

Instructions To Reproduce the 🐛 Bug:

  1. Full runnable code or full changes you made:
    cd new-python-project-requiring-detectron2
    echo 'detectron2 @ git+https://github.com/facebookresearch/detectron2.git#egg=detectron2@v0.6' >> requirements.txt
    python3.10 -m venv venv
    . venv/bin/activate
    python -m pip install -r requirements.txt

The above will fail as torch is not already available and not installed as a dependency

Desired behavior:

If detectron2 included torch as a stated dependency, it would make fresh install more straightforward. It currently crashes without a useful error message due to the import torch statement in setup.py

This limits the usefulness of using clean virtual environments (with repeatable requirements.txt) as a manual install of pytorch is required first

Programmer-RD-AI commented 1 month ago

An PR #5296 has been setup :)