From 37f3ba274a8ccebc6b3409f52cf068a8b23617d4 Mon Sep 17 00:00:00 2001 From: linhaifeng <102455956+lingebeng@users.noreply.github.com> Date: Thu, 16 Oct 2025 20:26:06 +0000 Subject: [PATCH] [Fix] Use sys.executable instead of hardcoded python (#165633) Replace hardcoded "python" string with sys.executable to ensure correct Python interpreter is used. This fixes failures on systems with multiple Python runtimes or where "python" is not in PATH. Similar to pytorch/pytorch#155918 Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/165633 Approved by: https://github.com/Skylion007 --- torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py b/torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py index e8041648227..3788a44e062 100644 --- a/torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py +++ b/torch/utils/benchmark/utils/valgrind_wrapper/timer_interface.py @@ -640,7 +640,7 @@ class _ValgrindWrapper: stat_log=stat_log, bindings=self._bindings_module)) - run_loop_cmd = ["python", script_file] + run_loop_cmd = [sys.executable, script_file] else: if collect_baseline: raise AssertionError("collect_baseline must be False for non-Python timers")