Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions scripts/windows/builder.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,21 @@ function Get-CMakeConfigureArgs {

$kwargs = @("..", "-G", "Visual Studio 17 2022", "-A", $vsArch)

# Detect Python from current environment
$pythonExe = (Get-Command python -ErrorAction SilentlyContinue).Source
if ($pythonExe) {
$kwargs += "-DPython3_EXECUTABLE=$pythonExe"
Write-Status "Using Python from environment: $pythonExe" -Type Info

# Verify Python and PyTorch version
$torchVersion = & $pythonExe -c "import torch; print(torch.__version__)" 2>$null
if ($torchVersion) {
Write-Status "Detected PyTorch version: $torchVersion" -Type Info
Comment on lines +338 to +342

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a tiny nit: the code only checks the PyTorch version, not Python, as the comment currently suggests.

@mfuntowicz mfuntowicz Oct 23, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does detect Python just above:

$pythonExe = (Get-Command python -ErrorAction SilentlyContinue).Source

and then reuse the Python executable to extract information about PyTorch within the detected python context 😊

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought you wanted to print the Python version too in that command! Looks good to me

}
} else {
Write-Status "Python not found in PATH, CMake will auto-detect" -Type Warning
}

if ($ShouldInstall -and $InstallPrefix) {
$kwargs += "-DCMAKE_INSTALL_PREFIX=$InstallPrefix"
Write-Status "Setting CMAKE_INSTALL_PREFIX=$InstallPrefix" -Type Info
Expand Down
Loading