[BE]: Fix setuptools not installed with Python 3.12 (#133561)

setuptools is not installed correctly for Python 3.12.
See https://github.com/python-poetry/poetry/issues/9630#issuecomment-2291114885

Pull Request resolved: https://github.com/pytorch/pytorch/pull/133561
Approved by: https://github.com/Skylion007

Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
This commit is contained in:
Christophe Bornet
2024-08-17 17:42:03 +00:00
committed by PyTorch MergeBot
parent b4a1673a67
commit d6368985af

View File

@ -1136,6 +1136,7 @@ def main():
install_requires = [
"filelock",
"typing-extensions>=4.8.0",
'setuptools ; python_version >= "3.12"',
'sympy==1.12.1 ; python_version == "3.8"',
'sympy==1.13.1 ; python_version >= "3.9"',
"networkx",
@ -1143,9 +1144,6 @@ def main():
"fsspec",
]
if sys.version_info >= (3, 12, 0):
install_requires.append("setuptools")
if BUILD_PYTHON_ONLY:
install_requires.append(f"{LIBTORCH_PKG_NAME}=={get_torch_version()}")