mirror of https://github.com/open-mmlab/mmcv.git
[Fix] Do not depend on setuptools>=52 (#1235)
* use packaging instead * update * update * update * updatepull/1254/head
parent
dfb48c87ae
commit
93418560d8
|
@ -41,8 +41,6 @@ jobs:
|
|||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Upgrade Setuptools
|
||||
run: pip install setuptools --upgrade
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
|
@ -77,8 +75,6 @@ jobs:
|
|||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Install PyTorch
|
||||
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
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
|
@ -122,8 +118,6 @@ jobs:
|
|||
if: ${{matrix.torchvision == '0.4.2'}}
|
||||
- name: Install PyTorch
|
||||
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
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
|
@ -194,8 +188,6 @@ jobs:
|
|||
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Upgrade Setuptools
|
||||
run: pip install setuptools --upgrade
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
|
@ -266,8 +258,6 @@ jobs:
|
|||
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} -f https://download.pytorch.org/whl/torch_stable.html
|
||||
- name: Install system dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg libturbojpeg
|
||||
- name: Upgrade Setuptools
|
||||
run: pip install setuptools --upgrade
|
||||
- name: Build and install
|
||||
run: rm -rf .eggs && pip install -e .
|
||||
- name: Validate the installation
|
||||
|
@ -320,8 +310,6 @@ jobs:
|
|||
if: ${{matrix.torchvision == '0.4.2'}}
|
||||
- name: Install PyTorch
|
||||
run: pip install torch==${{matrix.torch}} torchvision==${{matrix.torchvision}} --no-cache-dir
|
||||
- name: Upgrade Setuptools
|
||||
run: pip install setuptools --upgrade
|
||||
- name: Build and install
|
||||
run: |
|
||||
rm -rf .eggs
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
import os
|
||||
import subprocess
|
||||
import warnings
|
||||
from pkg_resources import parse_version
|
||||
|
||||
from packaging.version import parse
|
||||
|
||||
|
||||
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).
|
||||
"""
|
||||
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}'
|
||||
release = list(version.release)
|
||||
release = release[:length]
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# Copyright (c) OpenMMLab. All rights reserved.
|
||||
|
||||
from pkg_resources import parse_version
|
||||
|
||||
__version__ = '1.3.10'
|
||||
|
||||
|
||||
|
@ -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
|
||||
(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}'
|
||||
release = list(version.release)
|
||||
release = release[:length]
|
||||
|
@ -32,6 +30,6 @@ def parse_version_info(version_str: str, length: int = 4) -> tuple:
|
|||
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']
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
addict
|
||||
numpy
|
||||
packaging
|
||||
Pillow
|
||||
pyyaml
|
||||
regex;sys_platform=='win32'
|
||||
setuptools>=52
|
||||
yapf
|
||||
|
|
|
@ -6,5 +6,4 @@ onnxruntime==1.4.0
|
|||
pytest
|
||||
PyTurboJPEG
|
||||
scipy
|
||||
setuptools>=52
|
||||
tiffile
|
||||
|
|
6
setup.py
6
setup.py
|
@ -1,7 +1,7 @@
|
|||
import glob
|
||||
import os
|
||||
import re
|
||||
from pkg_resources import DistributionNotFound, get_distribution, parse_version
|
||||
from pkg_resources import DistributionNotFound, get_distribution
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
EXT_TYPE = ''
|
||||
|
@ -220,10 +220,12 @@ def get_extensions():
|
|||
include_dirs = []
|
||||
|
||||
is_rocm_pytorch = False
|
||||
if parse_version(torch.__version__) >= parse_version('1.5'):
|
||||
try:
|
||||
from torch.utils.cpp_extension import ROCM_HOME
|
||||
is_rocm_pytorch = True if ((torch.version.hip is not None) and
|
||||
(ROCM_HOME is not None)) else False
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
project_dir = 'mmcv/ops/csrc/'
|
||||
if is_rocm_pytorch:
|
||||
|
|
Loading…
Reference in New Issue