build(uv_unwrapper,texture_baker): add pyproject.toml declaring torch build-dep#88
Open
rebel-junamsong wants to merge 1 commit intoStability-AI:mainfrom
Open
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'
```