Unverified Commit 93418560 authored by Haodong Duan's avatar Haodong Duan Committed by GitHub
Browse files

[Fix] Do not depend on setuptools>=52 (#1235)

* use packaging instead

* update

* update

* update

* update
parent dfb48c87
...@@ -41,8 +41,6 @@ jobs: ...@@ -41,8 +41,6 @@ jobs:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install - name: Build and install
run: rm -rf .eggs && pip install -e . run: rm -rf .eggs && pip install -e .
- name: Validate the installation - name: Validate the installation
...@@ -77,8 +75,6 @@ jobs: ...@@ -77,8 +75,6 @@ jobs:
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install - name: Build and install
run: rm -rf .eggs && pip install -e . run: rm -rf .eggs && pip install -e .
- name: Validate the installation - name: Validate the installation
...@@ -122,8 +118,6 @@ jobs: ...@@ -122,8 +118,6 @@ jobs:
if: ${{matrix.torchvision == '0.4.2'}} if: ${{matrix.torchvision == '0.4.2'}}
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}}+cpu torchvision==${{matrix.torchvision}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install - name: Build and install
run: rm -rf .eggs && pip install -e . run: rm -rf .eggs && pip install -e .
- name: Validate the installation - name: Validate the installation
...@@ -194,8 +188,6 @@ jobs: ...@@ -194,8 +188,6 @@ jobs:
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install - name: Build and install
run: rm -rf .eggs && pip install -e . run: rm -rf .eggs && pip install -e .
- name: Validate the installation - name: Validate the installation
...@@ -266,8 +258,6 @@ jobs: ...@@ -266,8 +258,6 @@ jobs:
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
- name: Install system dependencies - name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install - name: Build and install
run: rm -rf .eggs && pip install -e . run: rm -rf .eggs && pip install -e .
- name: Validate the installation - name: Validate the installation
...@@ -320,8 +310,6 @@ jobs: ...@@ -320,8 +310,6 @@ jobs:
if: ${{matrix.torchvision == '0.4.2'}} if: ${{matrix.torchvision == '0.4.2'}}
- name: Install PyTorch - name: Install PyTorch
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} --no-cache-dir run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} --no-cache-dir
- name: Upgrade Setuptools
run: pip install setuptools --upgrade
- name: Build and install - name: Build and install
run: | run: |
rm -rf .eggs rm -rf .eggs
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
import os import os
import subprocess import subprocess
import warnings import warnings
from pkg_resources import parse_version
from packaging.version import parse
def digit_version(version_str: str, length: int = 4): def digit_version(version_str: str, length: int = 4):
...@@ -19,7 +20,7 @@ def digit_version(version_str: str, length: int = 4): ...@@ -19,7 +20,7 @@ def digit_version(version_str: str, length: int = 4):
tuple[int]: The version info in digits (integers). tuple[int]: The version info in digits (integers).
""" """
assert 'parrots' not in version_str assert 'parrots' not in version_str
version = parse_version(version_str) version = parse(version_str)
assert version.release, f'failed to parse version {version_str}' assert version.release, f'failed to parse version {version_str}'
release = list(version.release) release = list(version.release)
release = release[:length] release = release[:length]
......
# Copyright (c) OpenMMLab. All rights reserved. # Copyright (c) OpenMMLab. All rights reserved.
from pkg_resources import parse_version
__version__ = '1.3.10' __version__ = '1.3.10'
...@@ -17,7 +14,8 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple: ...@@ -17,7 +14,8 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
(1, 3, 0, 0, 0, 0), and "2.0.0rc1" is parsed into (1, 3, 0, 0, 0, 0), and "2.0.0rc1" is parsed into
(2, 0, 0, 0, 'rc', 1) (when length is set to 4). (2, 0, 0, 0, 'rc', 1) (when length is set to 4).
""" """
version = parse_version(version_str) from packaging.version import parse
version = parse(version_str)
assert version.release, f'failed to parse version {version_str}' assert version.release, f'failed to parse version {version_str}'
release = list(version.release) release = list(version.release)
release = release[:length] release = release[:length]
...@@ -32,6 +30,6 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple: ...@@ -32,6 +30,6 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
return tuple(release) return tuple(release)
version_info = parse_version_info(__version__) version_info = tuple(int(x) for x in __version__.split('.')[:3])
__all__ = ['__version__', 'version_info', 'parse_version_info'] __all__ = ['__version__', 'version_info', 'parse_version_info']
addict addict
numpy numpy
packaging
Pillow Pillow
pyyaml pyyaml
regex;sys_platform=='win32' regex;sys_platform=='win32'
setuptools>=52
yapf yapf
...@@ -6,5 +6,4 @@ onnxruntime==1.4.0 ...@@ -6,5 +6,4 @@ onnxruntime==1.4.0
pytest pytest
PyTurboJPEG PyTurboJPEG
scipy scipy
setuptools>=52
tiffile tiffile
import glob import glob
import os import os
import re import re
from pkg_resources import DistributionNotFound, get_distribution, parse_version from pkg_resources import DistributionNotFound, get_distribution
from setuptools import find_packages, setup from setuptools import find_packages, setup
EXT_TYPE = '' EXT_TYPE = ''
...@@ -220,10 +220,12 @@ def get_extensions(): ...@@ -220,10 +220,12 @@ def get_extensions():
include_dirs = [] include_dirs = []
is_rocm_pytorch = False is_rocm_pytorch = False
if parse_version(torch.__version__) >= parse_version('1.5'): try:
from torch.utils.cpp_extension import ROCM_HOME from torch.utils.cpp_extension import ROCM_HOME
is_rocm_pytorch = True if ((torch.version.hip is not None) and is_rocm_pytorch = True if ((torch.version.hip is not None) and
(ROCM_HOME is not None)) else False (ROCM_HOME is not None)) else False
except ImportError:
pass
project_dir = 'mmcv/ops/csrc/' project_dir = 'mmcv/ops/csrc/'
if is_rocm_pytorch: if is_rocm_pytorch:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment