From 047ae24e348c7a91c2776520f0d9b2bf005d2a28 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Fri, 26 Sep 2025 23:24:16 +0800 Subject: [PATCH] Eliminate setup.py install/develop in the codebose (#162329) Pull Request resolved: https://github.com/pytorch/pytorch/pull/162329 Approved by: https://github.com/ezyang --- codex_setup.sh | 2 +- torch/testing/_internal/common_utils.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/codex_setup.sh b/codex_setup.sh index 85c7b93e8979..5e47b1358ee5 100755 --- a/codex_setup.sh +++ b/codex_setup.sh @@ -10,5 +10,5 @@ COMMIT_DATE=$(echo "$NIGHTLY_PATCH" | grep '^Date:' | sed -E 's/Date: .*, ([0-9] VERSION_STRING="2.9.0.dev${COMMIT_DATE}+cpu" git rev-parse HEAD > /tmp/orig_work.txt git reset --hard $COMMIT -USE_NIGHTLY=$VERSION_STRING python setup.py develop +USE_NIGHTLY=$VERSION_STRING python -m pip install --no-build-isolation -v -e . echo "source $PWD/.venv/bin/activate" >> ~/.bashrc diff --git a/torch/testing/_internal/common_utils.py b/torch/testing/_internal/common_utils.py index 5a3cd108d522..a2e27ddf82d3 100644 --- a/torch/testing/_internal/common_utils.py +++ b/torch/testing/_internal/common_utils.py @@ -5696,8 +5696,7 @@ def install_cpp_extension(extension_root): shutil.rmtree(d) # Build the extension - setup_py_path = os.path.join(extension_root, "setup.py") - cmd = [sys.executable, setup_py_path, "install", "--root", install_dir] + cmd = [sys.executable, "-m", "pip", "install", "--no-build-isolation", "-v", ".", "--root", install_dir] return_code = shell(cmd, cwd=extension_root, env=os.environ) if return_code != 0: raise RuntimeError(f"build failed for cpp extension at {extension_root}")