Skip to content

Commit

Permalink
temporarily fix collect_env raise errors and stops programs
Browse files Browse the repository at this point in the history
  • Loading branch information
C1rN09 committed Feb 21, 2023
1 parent e16dacf commit 157d78f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mmengine/utils/dl_utils/collect_env.py
Expand Up @@ -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:
Expand All @@ -119,6 +120,15 @@ 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
env_info['MSVC'] = f'n/a, reason: {str(e)}'
except Exception as e:
# Other exceptions we haven't considered, record the reason but don't
# stop program from running
env_info['GCC'] = f'n/a, reason: {str(e)}'
env_info['MSVC'] = f'n/a, reason: {str(e)}'

env_info['PyTorch'] = torch.__version__
env_info['PyTorch compiling details'] = get_build_config()
Expand Down

0 comments on commit 157d78f

Please sign in to comment.