[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
pull/948/head
Qian Zhao 2023-02-22 00:25:36 +08:00 committed by GitHub
parent b14c179fad
commit e271454527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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()