Using pip3 install instead of python setup.py develop/install (#161903)

As the title stated.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/161903
Approved by: https://github.com/ezyang
ghstack dependencies: #161845
This commit is contained in:
FFFrog
2025-09-02 20:44:12 +08:00
committed by PyTorch MergeBot
parent d789451ff6
commit dac8a4b91c

View File

@ -655,8 +655,16 @@ def install_cpp_extensions(cpp_extensions_test_dir, env=os.environ):
shutil.rmtree(cpp_extensions_test_build_dir)
# Build the test cpp extensions modules
# FIXME: change setup.py command to pip command
cmd = [sys.executable, "setup.py", "install", "--root", "./install"]
cmd = [
sys.executable,
"-m",
"pip",
"install",
"--no-build-isolation",
".",
"--root",
"./install",
]
return_code = shell(cmd, cwd=cpp_extensions_test_dir, env=env)
if return_code != 0:
return None, return_code
@ -815,8 +823,17 @@ def _test_cpp_extensions_aot(test_directory, options, use_ninja):
# Build the test cpp extensions modules
shell_env = os.environ.copy()
shell_env["USE_NINJA"] = str(1 if use_ninja else 0)
install_cmd = [sys.executable, "setup.py", "install", "--root", "./install"]
wheel_cmd = [sys.executable, "setup.py", "bdist_wheel"]
install_cmd = [
sys.executable,
"-m",
"pip",
"install",
"--no-build-isolation",
".",
"--root",
"./install",
]
wheel_cmd = [sys.executable, "-m", "pip", "wheel", ".", "-w", "./dist"]
return_code = shell(install_cmd, cwd=cpp_extensions_test_dir, env=shell_env)
if return_code != 0:
return return_code