From 4233f3b077ab8e5057ec69a65741ac546d55db48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8D=97?= Date: Thu, 3 Jun 2021 17:12:00 +0800 Subject: [PATCH] fix runcheck bug --- mindspore/__init__.py | 5 ++--- mindspore/run_check/_check_version.py | 10 ++++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/mindspore/__init__.py b/mindspore/__init__.py index 1e0c8978fe9..451e10c81aa 100755 --- a/mindspore/__init__.py +++ b/mindspore/__init__.py @@ -22,10 +22,9 @@ from .train import * from .log import * from .version import __version__ -all = ["run_check"] -__all__ = [] + +__all__ = ["run_check"] __all__.extend(__version__) -__all__.extend(run_check.__all__) __all__.extend(common.__all__) __all__.extend(train.__all__) __all__.extend(log.__all__) diff --git a/mindspore/run_check/_check_version.py b/mindspore/run_check/_check_version.py index 9523ee25c57..eea3919823f 100644 --- a/mindspore/run_check/_check_version.py +++ b/mindspore/run_check/_check_version.py @@ -163,12 +163,13 @@ class GPUEnvChecker(EnvChecker): """Get gpu lib path by ldd command.""" path_list = [] current_path = os.path.split(os.path.realpath(__file__))[0] + mindspore_path = os.path.join(current_path, "../") try: - ldd_result = subprocess.run(["ldd " + current_path + "/_c_expression*.so* | grep " + lib_name], + ldd_result = subprocess.run(["ldd " + mindspore_path + "/_c_expression*.so* | grep " + lib_name], timeout=10, text=True, capture_output=True, check=False, shell=True) if ldd_result.returncode: logger.error(f"{self.lib_key_to_lib_name[lib_name]} (need by mindspore-gpu) is not found, please " - f"confirm that _c_expression.so is in directory:{current_path} and the correct cuda " + f"confirm that _c_expression.so is in directory:{mindspore_path} and the correct cuda " "version has been installed, you can refer to the installation " "guidelines: https://www.mindspore.cn/install") return path_list @@ -298,7 +299,8 @@ class AscendEnvChecker(EnvChecker): return try: - import te + import te # pylint: disable=unused-import + # pylint: disable=broad-except except Exception: if Path(self.tbe_path).is_dir(): if os.getenv('LD_LIBRARY_PATH'): @@ -391,7 +393,7 @@ def check_version_and_env_config(): try: # check version of ascend site or cuda env_checker.check_version() - from .. import _c_expression + from .. import _c_expression # pylint: disable=unused-import env_checker.set_env() except ImportError as e: env_checker.check_env(e)