Skip to content

Commit 6c27dbc

Browse files
authored
Fix issue with setuptools.distutils.version
1 parent 9cb1cff commit 6c27dbc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/pytorch-version-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ jobs:
9494
pip install -r requirements-dev.txt
9595
python setup.py install
9696
97+
# pytorch>=1.9.0,<1.11.0 is using "from setuptools import distutils; distutils.version.LooseVersion" anti-pattern
98+
# which raises the error: AttributeError: module 'distutils' has no attribute 'version' for setuptools>59
99+
bad_pth_version=$(python -c "import torch; print('.'.join(torch.__version__.split('.')[:2])) in ['1.9', '1.10']")
100+
if [ "${bad_pth_version}" -eq "True" ]; then
101+
pip install --upgrade "setuptools<59"
102+
python -c "from setuptools import distutils; distutils.version.LooseVersion"
103+
fi
104+
97105
# There is no more torchvision 0.5.0 binaries in anaconda pytorch channel:
98106
# https://anaconda.org/pytorch/torchvision/files
99107
- name: Install appropriate dependencies for PyTorch 1.4.0

0 commit comments

Comments
 (0)