ROCm / pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration
http://pytorch.org
Other
219 stars 50 forks source link

[release/2.1] Remove references to `pkg_resources.packaging` #1422

Closed jithunnair-amd closed 1 month ago

jithunnair-amd commented 1 month ago

Removed in setuptools 70.0.0

Wheel builds for mainline build 14054 were failing with:

[2024-05-23T11:17:41.204Z] ++ pip install --upgrade setuptools
[2024-05-23T11:17:41.204Z] Requirement already satisfied: setuptools in /opt/_internal/cpython-3.10.1/lib/python3.10/site-packages (58.1.0)
[2024-05-23T11:17:41.458Z] Collecting setuptools
[2024-05-23T11:17:41.458Z]   Downloading setuptools-70.0.0-py3-none-any.whl.metadata (5.9 kB)
[2024-05-23T11:17:41.458Z] Downloading setuptools-70.0.0-py3-none-any.whl (863 kB)
[2024-05-23T11:17:41.458Z]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/863.4 kB ? eta -:--:--
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 863.4/863.4 kB 35.2 MB/s eta 0:00:00
[2024-05-23T11:17:42.018Z] Installing collected packages: setuptools
[2024-05-23T11:17:42.018Z]   Attempting uninstall: setuptools
[2024-05-23T11:17:42.018Z]     Found existing installation: setuptools 58.1.0
[2024-05-23T11:17:42.018Z]     Uninstalling setuptools-58.1.0:
[2024-05-23T11:17:42.018Z]       Successfully uninstalled setuptools-58.1.0
[2024-05-23T11:17:42.578Z] Successfully installed setuptools-70.0.0
[2024-05-23T11:17:42.578Z] WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
[2024-05-23T11:17:42.836Z] + python3 setup.py bdist_wheel
[2024-05-23T11:17:44.720Z] /vision/setup.py:10: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
[2024-05-23T11:17:44.720Z]   from pkg_resources import DistributionNotFound, get_distribution, parse_version
[2024-05-23T11:17:44.975Z] Traceback (most recent call last):
[2024-05-23T11:17:44.975Z]   File "/vision/setup.py", line 12, in <module>
[2024-05-23T11:17:44.975Z]     from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDA_HOME, CUDAExtension
[2024-05-23T11:17:44.975Z]   File "/opt/python/cp310-cp310/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 28, in <module>
[2024-05-23T11:17:44.975Z]     from pkg_resources import packaging  # type: ignore[attr-defined]
[2024-05-23T11:17:44.975Z] ImportError: cannot import name 'packaging' from 'pkg_resources' (/opt/python/cp310-cp310/lib/python3.10/site-packages/pkg_resources/__init__.py)

Cherry-pick https://github.com/pytorch/pytorch/commit/71ca42787f8a18e0e49714d45cab45e961700b8e

Tested via: http://rocm-ci.amd.com/job/rocm-pytorch-manylinux-wheel-builder/294

This PR was followed-up by another companion commit to fix issues with using TorchVersion: https://github.com/ROCm/pytorch/commit/6918923b9c4d935bfc2f1b599c37870cb2c2b357