mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
going back to use packaging.version.parse instead (#61053)
Summary: I think this may be related to https://app.circleci.com/pipelines/github/pytorch/vision/9352/workflows/9c8afb1c-6157-4c82-a5c8-105c5adac57d/jobs/687003 Apparently `pkg_resource.parse_version` returns a type of `pkg_resources.extern.packaging.version.Version` instead of `packaging.version.Version` and seems on some older version of the setuptools it doesn't support `.major/minor` operation. changing it back to using `packaging.version.parse` Pull Request resolved: https://github.com/pytorch/pytorch/pull/61053 Test Plan: CI Reviewed By: samestep Differential Revision: D29494322 Pulled By: walterddr fbshipit-source-id: 294572a10b167677440d7404e5ebe007ab59d299
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a2ad84afbb
commit
2d0c6e60a7
@ -20,7 +20,7 @@ from .hipify.hipify_python import get_hip_file_path, GeneratedFileCleaner
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from setuptools.command.build_ext import build_ext
|
||||
from pkg_resources import packaging, parse_version # type: ignore[attr-defined]
|
||||
from pkg_resources import packaging # type: ignore[attr-defined]
|
||||
|
||||
IS_WINDOWS = sys.platform == 'win32'
|
||||
LIB_EXT = '.pyd' if IS_WINDOWS else '.so'
|
||||
@ -771,8 +771,8 @@ class BuildExtension(build_ext, object):
|
||||
cuda_version = re.search(r'release (\d+[.]\d+)', cuda_version_str)
|
||||
if cuda_version is not None:
|
||||
cuda_str_version = cuda_version.group(1)
|
||||
cuda_ver = parse_version(cuda_str_version)
|
||||
torch_cuda_version = parse_version(torch.version.cuda) # type: ignore[arg-type]
|
||||
cuda_ver = packaging.version.parse(cuda_str_version)
|
||||
torch_cuda_version = packaging.version.parse(torch.version.cuda)
|
||||
if cuda_ver.major != torch_cuda_version.major: # type: ignore[attr-defined]
|
||||
raise RuntimeError(CUDA_MISMATCH_MESSAGE.format(
|
||||
cuda_str_version, torch.version.cuda))
|
||||
|
Reference in New Issue
Block a user