Replace setup.py install with pip install (#156711)

#156027 already replaced most use of `python setup.py install`.
This PR only adds a few more occurrences and adds `--no-build-isolation` in a few places.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/156711
Approved by: https://github.com/atalman
This commit is contained in:
Klaus Zimmermann
2025-09-29 10:37:14 +02:00
committed by PyTorch MergeBot
parent 92284fb2ff
commit fa54b08cd5
5 changed files with 6 additions and 5 deletions

View File

@ -104,7 +104,7 @@ if [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
export ROCclr_DIR=/opt/rocm/rocclr/lib/cmake/rocclr export ROCclr_DIR=/opt/rocm/rocclr/lib/cmake/rocclr
fi fi
echo "Calling 'python -m pip install .' at $(date)" echo "Calling -m pip install . -v --no-build-isolation at $(date)"
if [[ $LIBTORCH_VARIANT = *"static"* ]]; then if [[ $LIBTORCH_VARIANT = *"static"* ]]; then
STATIC_CMAKE_FLAG="-DTORCH_STATIC=1" STATIC_CMAKE_FLAG="-DTORCH_STATIC=1"

View File

@ -1617,7 +1617,7 @@ test_operator_benchmark() {
test_inductor_set_cpu_affinity test_inductor_set_cpu_affinity
cd benchmarks/operator_benchmark/pt_extension cd benchmarks/operator_benchmark/pt_extension
python -m pip install . python -m pip install . -v --no-build-isolation
cd "${TEST_DIR}"/benchmarks/operator_benchmark cd "${TEST_DIR}"/benchmarks/operator_benchmark
$TASKSET python -m benchmark_all_test --device "$1" --tag-filter "$2" \ $TASKSET python -m benchmark_all_test --device "$1" --tag-filter "$2" \

View File

@ -20,7 +20,7 @@ Key Features:
The instruction below installs a cpp\_extension for PyTorch and it is required to run the benchmark suite. The instruction below installs a cpp\_extension for PyTorch and it is required to run the benchmark suite.
```bash ```bash
cd pt_extension cd pt_extension
python -m pip install . python -m pip install . -v --no-build-isolation
``` ```
## How to run the benchmarks: ## How to run the benchmarks:

View File

@ -148,7 +148,8 @@ class TestCppExtensionAOT(common.TestCase):
@unittest.skipIf(IS_WINDOWS, "Not available on Windows") @unittest.skipIf(IS_WINDOWS, "Not available on Windows")
def test_no_python_abi_suffix_sets_the_correct_library_name(self): def test_no_python_abi_suffix_sets_the_correct_library_name(self):
# For this test, run_test.py will call `python -m pip install .` in the # For this test, run_test.py will call
# `python -m pip install . -v --no-build-isolation` in the
# cpp_extensions/no_python_abi_suffix_test folder, where the # cpp_extensions/no_python_abi_suffix_test folder, where the
# `BuildExtension` class has a `no_python_abi_suffix` option set to # `BuildExtension` class has a `no_python_abi_suffix` option set to
# `True`. This *should* mean that on Python 3, the produced shared # `True`. This *should* mean that on Python 3, the produced shared

View File

@ -5696,7 +5696,7 @@ def install_cpp_extension(extension_root):
shutil.rmtree(d) shutil.rmtree(d)
# Build the extension # Build the extension
cmd = [sys.executable, "-m", "pip", "install", "--no-build-isolation", "-v", ".", "--root", install_dir] cmd = [sys.executable, "-m", "pip", "install", extension_root, "-v", "--no-build-isolation", "--root", install_dir]
return_code = shell(cmd, cwd=extension_root, env=os.environ) return_code = shell(cmd, cwd=extension_root, env=os.environ)
if return_code != 0: if return_code != 0:
raise RuntimeError(f"build failed for cpp extension at {extension_root}") raise RuntimeError(f"build failed for cpp extension at {extension_root}")