|
25 | 25 | from torch.torch_version import TorchVersion
|
26 | 26 |
|
27 | 27 | from setuptools.command.build_ext import build_ext
|
28 |
| -from pkg_resources import packaging # type: ignore[attr-defined] |
| 28 | +import packaging.version |
29 | 29 |
|
30 | 30 | IS_WINDOWS = sys.platform == 'win32'
|
31 | 31 | IS_MACOS = sys.platform.startswith('darwin')
|
@@ -404,6 +404,9 @@ def _check_cuda_version(compiler_name: str, compiler_version: TorchVersion) -> N
|
404 | 404 |
|
405 | 405 | cuda_str_version = cuda_version.group(1)
|
406 | 406 | cuda_ver = packaging.version.parse(cuda_str_version)
|
| 407 | + if torch.version.cuda is None: |
| 408 | + return |
| 409 | + |
407 | 410 | torch_cuda_version = packaging.version.parse(torch.version.cuda)
|
408 | 411 | if cuda_ver != torch_cuda_version:
|
409 | 412 | # major/minor attributes are only available in setuptools>=49.4.0
|
@@ -2345,8 +2348,7 @@ def sanitize_flags(flags):
|
2345 | 2348 | # Compilation will work on earlier CUDA versions but header file
|
2346 | 2349 | # dependencies are not correctly computed.
|
2347 | 2350 | required_cuda_version = packaging.version.parse('11.0')
|
2348 |
| - has_cuda_version = torch.version.cuda is not None |
2349 |
| - if has_cuda_version and packaging.version.parse(torch.version.cuda) >= required_cuda_version: |
| 2351 | + if torch.version.cuda is not None and packaging.version.parse(torch.version.cuda) >= required_cuda_version: |
2350 | 2352 | cuda_compile_rule.append(' depfile = $out.d')
|
2351 | 2353 | cuda_compile_rule.append(' deps = gcc')
|
2352 | 2354 | # Note: non-system deps with nvcc are only supported
|
|
0 commit comments