diff --git a/pyproject.toml b/pyproject.toml index 52b7b99ef8d1..47a77cdce39c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,10 @@ Forum = "https://discuss.pytorch.org/" [build-system] requires = [ # After 75.8.2 dropped dep disttools API. Please fix + # API temporarily restored and shim used. Please fix + # Setuptools will drop support for setup.py past 80 # min version for recursive glob package data support - "setuptools>=62.3.0,<75.9", + "setuptools>=62.3.0,<80.0", "wheel", "astunparse", "numpy", diff --git a/requirements.txt b/requirements.txt index 01f358ec9e9e..18f7810de951 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,8 +15,8 @@ packaging psutil pyyaml requests -# issue on Windows after >= 75.8.2 - https://github.com/pytorch/pytorch/issues/148877 -setuptools>=62.3.0,<75.9 +# setuptools develop deprecated on 80.0 +setuptools>=62.3.0,<80.0 sympy>=1.13.3 types-dataclasses typing-extensions>=4.10.0 diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py index 7697b9394a38..c0f9cbc88b5d 100644 --- a/torch/utils/cpp_extension.py +++ b/torch/utils/cpp_extension.py @@ -2533,9 +2533,12 @@ def _get_vc_env(vc_arch: str) -> dict[str, str]: from setuptools import distutils return distutils._msvccompiler._get_vc_env(vc_arch) except AttributeError: - from setuptools._distutils import _msvccompiler - return _msvccompiler._get_vc_env(vc_arch) - + try: + from setuptools._distutils import _msvccompiler + return _msvccompiler._get_vc_env(vc_arch) + except AttributeError: + from setuptools._distutils.compilers.C import msvc + return msvc._get_vc_env(vc_arch) def _run_ninja_build(build_directory: str, verbose: bool, error_prefix: str) -> None: command = ['ninja', '-v']