build: add torch to build-system.requires#30
Open
rebel-junamsong wants to merge 1 commit intotatsy:masterfrom
Open
build: add torch to build-system.requires#30rebel-junamsong wants to merge 1 commit intotatsy:masterfrom
rebel-junamsong wants to merge 1 commit intotatsy:masterfrom
Conversation
scikit-build-core's isolated build env runs CMakeLists.txt which calls find_package(Torch CONFIG REQUIRED). The Torch CMake package ships inside the installed PyTorch Python package (torch/share/cmake/Torch/ TorchConfig.cmake), so torch must be importable in the build env. Without listing torch in [build-system].requires, any clean `pip install git+https://github.com/tatsy/torchmcubes.git` fails with CMake Error at CMakeLists.txt:43 (find_package): Could not find a package configuration file provided by "Torch" Adding torch here makes the install work in isolated build environments without requiring --no-build-isolation or manually pre-installing torch.
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
`CMakeLists.txt` calls `find_package(Torch CONFIG REQUIRED)`, which searches for `TorchConfig.cmake` that ships inside the installed PyTorch Python package (`/torch/share/cmake/Torch/TorchConfig.cmake`). However, `torch` is not declared in `[build-system].requires`, so pip/uv's isolated build environment never has torch installed, causing the CMake configuration step to fail in any clean environment:
```
CMake Error at CMakeLists.txt:43 (find_package):
Could not find a package configuration file provided by "Torch" with any of
the following names:
```
Users currently have to either disable build isolation (`--no-build-isolation` plus pre-installing torch in the target env) or install from a working local checkout, rather than the simple `pip install git+https://github.com/tatsy/torchmcubes.git\`.
Fix
Minimal change: add `torch` to the existing `[build-system].requires` list. `cmake` and `ninja` are left untouched to stay consistent with the current project style.
```diff
[build-system]
-requires = ["scikit-build-core>=0.10", "pybind11>=2.10", "cmake", "ninja"]
+requires = ["scikit-build-core>=0.10", "pybind11>=2.10", "cmake", "ninja", "torch"]
```
Verification
After this change, `pip install git+https://github.com/tatsy/torchmcubes.git\` succeeds in a clean venv without any external workaround (no `--no-build-isolation`, no manually prepended `CMAKE_PREFIX_PATH`).