Skip to content

UV does not work with detectron #16767

@1uck13ss

Description

@1uck13ss

Summary

I have an issue with UV and detectron2, when I ran UV with this pyproject.toml as suggested by #16243, it did not work. I tried a simple test by importing detectron2 but i encountered the error torch not found even though torch is installed.

name = "balance"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "torch",
    "torchvision",
    "detectron2 @ git+https://github.com/facebookresearch/detectron2.git",
]

[tool.uv.extra-build-dependencies]
detectron2 = [{ requirement = "torch", match-runtime = true }]

[[tool.uv.index]]
name = "pypi"
url  = "https://pypi.org/simple"
default = true

[[tool.uv.index]]
name = "pytorch-cu128"
url  = "https://download.pytorch.org/whl/cu128"

[tool.uv.sources]
torch = { index = "pytorch-cu128" }
torchvision = { index = "pytorch-cu128" }

here are my environments
torch==2.9.1
torchaudio==2.5.0
torchvision==0.20.0
traitlets==5.14.3
typing-extensions==4.15.0
wcwidth==0.2.14
wheel==0.45.1

Platform

Windows 11

Version

0.9.10

Python version

Python 3.10.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions