mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Newer versions of distutils no longer import `_msvccompiler` upon init(on Windows platform, that was not the case on other platforms even before 74), but it's still accessible if one chooses to import it directly. Test plan: ``` % python -c 'from setuptools import distutils; print(distutils.__version__, hasattr(distutils, "_msvccompiler")); from distutils import _msvccompiler; import setuptools; print(setuptools.__version__, _msvccompiler.__file__)' 3.10.9 False 65.5.0 /usr/local/fbcode/platform010/Python3.10.framework/Versions/3.10/lib/python3.10/site-packages/setuptools/_distutils/_msvccompiler.py ``` and ``` % python -c 'from setuptools import distutils; print(distutils.__version__, hasattr(distutils, "_msvccompiler")); from distutils import _msvccompiler; import setuptools; print(setuptools.__version__, _msvccompiler.__file__)' 3.13.0 False 75.6.0 /Users/malfet/py312-venv/lib/python3.13/site-packages/setuptools/_distutils/_msvccompiler.py ``` Gave up trying to appease the linker, so rewrote it as following function: ```python def _get_vc_env(vc_arch: str) -> dict[str, str]: try: from setuptools import distutils # type: ignore[import] return distutils._msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return] except AttributeError: from setuptools._distutils import _msvccompiler #type: ignore[import] return _msvccompiler._get_vc_env(vc_arch) # type: ignore[no-any-return] ``` This PR also undoes setuptools version restriction introduced by https://github.com/pytorch/pytorch/pull/136489 as premise for restriction is incorrect Fixes https://github.com/pytorch/pytorch/issues/141319 Pull Request resolved: https://github.com/pytorch/pytorch/pull/141363 Approved by: https://github.com/huydhn, https://github.com/atalman
22 lines
322 B
Plaintext
22 lines
322 B
Plaintext
# Python dependencies required for development
|
|
astunparse
|
|
expecttest>=0.2.1
|
|
hypothesis
|
|
numpy
|
|
psutil
|
|
pyyaml
|
|
requests
|
|
setuptools
|
|
types-dataclasses
|
|
typing-extensions>=4.10.0
|
|
sympy==1.13.1 ; python_version >= "3.9"
|
|
filelock
|
|
networkx
|
|
jinja2
|
|
fsspec
|
|
lintrunner ; platform_system != "Windows"
|
|
ninja
|
|
packaging
|
|
optree>=0.13.0
|
|
cmake
|