From e2714545278c3a6cb06f7571a59e6ee4592785a2 Mon Sep 17 00:00:00 2001 From: Qian Zhao <112053249+C1rN09@users.noreply.github.com> Date: Wed, 22 Feb 2023 00:25:36 +0800 Subject: [PATCH] [Fix] Temporarily fix collect_env raises errors and stops programs (#944) * temporarily fix `collect_env` raise errors and stops programs * remove the final catch block --- mmengine/utils/dl_utils/collect_env.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mmengine/utils/dl_utils/collect_env.py b/mmengine/utils/dl_utils/collect_env.py index 341e02aa..021503e7 100644 --- a/mmengine/utils/dl_utils/collect_env.py +++ b/mmengine/utils/dl_utils/collect_env.py @@ -95,6 +95,7 @@ def collect_env(): # Check C++ Compiler. # For Unix-like, sysconfig has 'CC' variable like 'gcc -pthread ...', # indicating the compiler used, we use this to get the compiler name + import io import sysconfig cc = sysconfig.get_config_var('CC') if cc: @@ -119,6 +120,12 @@ def collect_env(): env_info['GCC'] = 'n/a' except (subprocess.CalledProcessError, errors.DistutilsPlatformError): env_info['GCC'] = 'n/a' + except io.UnsupportedOperation as e: + # JupyterLab on Windows changes sys.stdout, which has no `fileno` attr + # Refer to: https://github.com/open-mmlab/mmengine/issues/931 + # TODO: find a solution to get compiler info in Windows JupyterLab, + # while preserving backward-compatibility in other systems. + env_info['MSVC'] = f'n/a, reason: {str(e)}' env_info['PyTorch'] = torch.__version__ env_info['PyTorch compiling details'] = get_build_config()