Skip to content

build(uv_unwrapper,texture_baker): add pyproject.toml declaring torch build-dep#88

Open
rebel-junamsong wants to merge 1 commit intoStability-AI:mainfrom
rebel-junamsong:build/add-pyproject-for-ext
Open

build(uv_unwrapper,texture_baker): add pyproject.toml declaring torch build-dep#88
rebel-junamsong wants to merge 1 commit intoStability-AI:mainfrom
rebel-junamsong:build/add-pyproject-for-ext

Conversation

@rebel-junamsong
Copy link
Copy Markdown

Problem

Both `uv_unwrapper/setup.py` and `texture_baker/setup.py` call `import torch` and `from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension` at module import time. Because neither subdirectory ships a `pyproject.toml`, pip/uv fall back to the default PEP 517 build env that only contains `setuptools` + `wheel` — no torch.

As a result, `pip install git+https://github.com/Stability-AI/stable-fast-3d.git#subdirectory=uv_unwrapper\` (and the equivalent for `texture_baker`) fails in any clean environment with:

```
ModuleNotFoundError: No module named 'torch'
```

Users currently have to either disable build isolation (which requires pre-installing torch + setuptools in the target env) or install from a working local checkout.

Fix

Add a minimal `pyproject.toml` to each subpackage declaring `torch` as a build-system requirement so the isolated build env has torch available. The existing `setup.py` is untouched.

```toml
[build-system]
requires = ["setuptools>=61", "wheel", "torch"]
build-backend = "setuptools.build_meta"
```

Verification

After this change, both of the following succeed in a clean venv:

```bash
pip install 'uv_unwrapper @ git+https://github.com/Stability-AI/stable-fast-3d.git#subdirectory=uv_unwrapper'
pip install 'texture_baker @ git+https://github.com/Stability-AI/stable-fast-3d.git#subdirectory=texture_baker'
```

… build-dep

Both subpackages' setup.py does `import torch` and `from
torch.utils.cpp_extension import BuildExtension, CppExtension,
CUDAExtension` at module import time. Because neither subdirectory
ships a pyproject.toml, pip/uv fall back to the default PEP 517 build
env that only contains setuptools + wheel — no torch.

As a result, `pip install git+URL#subdirectory=uv_unwrapper` (and
likewise for texture_baker) fails in any clean environment with:

  ModuleNotFoundError: No module named 'torch'

Add a minimal pyproject.toml to each subpackage declaring torch as a
build-system requirement so the isolated build env has torch available.
The existing setup.py is untouched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant