From 0447f2d99b4351b2ff129dce6eebb371024f73e5 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Tue, 2 Sep 2025 16:39:21 -0700 Subject: [PATCH] build: Add fallback commands to setup.py (#162009) Adds fallback commands for the following: * python setup.py install * python setup.py develop Ideally these should just work and should provide backwards compat. Thought process here is that multiple people rely on these commands and just because setuptools wants to drop support for this I don't think a lot of our downstream users who build from source are expecting these to be gone. This should provide some room for developers to move away from these commands until we have a unified frontend for doing all of these commands that should abstract most of these away. Signed-off-by: Eli Uriegas Pull Request resolved: https://github.com/pytorch/pytorch/pull/162009 Approved by: https://github.com/clee2000, https://github.com/atalman --- setup.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/setup.py b/setup.py index 203e09f1b733..c1803ef25567 100644 --- a/setup.py +++ b/setup.py @@ -420,6 +420,41 @@ for i, arg in enumerate(sys.argv): if arg == "rebuild" or arg == "build": arg = "build" # rebuild is gone, make it build EMIT_BUILD_WARNING = True + if arg == "develop": + print( + ( + "WARNING: Redirecting 'python setup.py develop' to 'pip install -e . -v --no-build-isolation'," + " for more info see https://github.com/pytorch/pytorch/issues/152276" + ), + file=sys.stderr, + ) + result = subprocess.run( + [ + sys.executable, + "-m", + "pip", + "install", + "-e", + ".", + "-v", + "--no-build-isolation", + ], + env={**os.environ}, + ) + sys.exit(result.returncode) + if arg == "install": + print( + ( + "WARNING: Redirecting 'python setup.py install' to 'pip install . -v --no-build-isolation'," + " for more info see https://github.com/pytorch/pytorch/issues/152276" + ), + file=sys.stderr, + ) + result = subprocess.run( + [sys.executable, "-m", "pip", "install", ".", "-v", "--no-build-isolation"], + env={**os.environ}, + ) + sys.exit(result.returncode) if arg == "--": filtered_args += sys.argv[i:] break