From df38261e85107c610a61ced0532f46c514b9e77b Mon Sep 17 00:00:00 2001 From: Kelvin R Date: Sat, 27 Jul 2024 10:37:51 -0700 Subject: [PATCH] Fixing imports --- monai/utils/module.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/monai/utils/module.py b/monai/utils/module.py index 747d3a17b9..59eaedd1eb 100644 --- a/monai/utils/module.py +++ b/monai/utils/module.py @@ -29,8 +29,8 @@ from typing import Any, Iterable, cast import torch -import importlib.metadata - +## import importlib.metadata +## from packaging import version # bundle config system flags # set MONAI_EVAL_EXPR=1 to use 'eval', default value: run_eval=True @@ -566,10 +566,10 @@ def version_leq(lhs: str, rhs: str) -> bool: """ lhs, rhs = str(lhs), str(rhs) - pkging, has_ver = optional_import("packaging") + has_ver = optional_import("packaging") if has_ver: try: - return cast(bool, pkging.version.Version(lhs) <= pkging.version.Version(rhs)) + return cast(bool, version(lhs) <= version(rhs)) except version.InvalidVersion: return True @@ -593,10 +593,10 @@ def version_geq(lhs: str, rhs: str) -> bool: """ lhs, rhs = str(lhs), str(rhs) - pkging, has_ver = optional_import("packaging") + has_ver = optional_import("packaging") if has_ver: try: - return cast(bool, pkging.version.Version(lhs) >= pkging.version.Version(rhs)) + return cast(bool, version(lhs) >= version(rhs)) except version.InvalidVersion: return True