본문 바로가기
IT관련 공부/파이썬(Python)

Error while enumerating installed packages. 해결법

by 행복한 위드 2024. 2. 7.

Error while enumerating installed packages. 파이썬 파일의 실행에는 문제가없지만 실행하면 많은 코드와 함께 오류와 함께 실행된다.

print('Hello Wolrd')를 출력하면 

 

E+00000.063: Error while enumerating installed packages.

Traceback (most recent call last): File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\common\log.py", line 361, in get_environment_description report(" {0}=={1}\n", pkg.name, pkg.version) AttributeError: 'PathDistribution' object has no attribute 'name' Stack where logged: File "C:\Users\kimk1\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\kimk1\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\launcher\__main__.py", line 91, in <module> main() File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\launcher\__main__.py", line 21, in main log.describe_environment("debugpy.launcher startup environment:") File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\common\log.py", line 369, in describe_environment info("{0}", get_environment_description(header)) File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\common\log.py", line 363, in get_environment_description swallow_exception("Error while enumerating installed packages.") File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\launcher/../..\debugpy\common\log.py", line 215, in swallow_exception _exception(format_string, *args, **kwargs)

 

E+00000.047: Error while enumerating installed packages. Traceback (most recent call last): File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 361, in get_environment_description report(" {0}=={1}\n", pkg.name, pkg.version) AttributeError: 'PathDistribution' object has no attribute 'name' Stack where logged: File "c:\Users\kimk1\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\Users\kimk1\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\__main__.py", line 39, in <module> cli.main() File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\server\cli.py", line 415, in main api.ensure_logging() File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\server\api.py", line 61, in ensure_logging log.describe_environment("Initial environment:") File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 369, in describe_environment info("{0}", get_environment_description(header)) File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 363, in get_environment_description swallow_exception("Error while enumerating installed packages.") File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 215, in swallow_exception _exception(format_string, *args, **kwargs)

E+00000.187: Error while enumerating installed packages. Traceback (most recent call last): File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 361, in get_environment_description report(" {0}=={1}\n", pkg.name, pkg.version) AttributeError: 'PathDistribution' object has no attribute 'name' Stack where logged: File "c:\Users\kimk1\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\Users\kimk1\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy\__main__.py", line 39, in <module> cli.main() File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\server\cli.py", line 430, in main run() File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\server\cli.py", line 281, in run_file log.describe_environment("Pre-launch environment:") File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 369, in describe_environment info("{0}", get_environment_description(header)) File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 363, in get_environment_description swallow_exception("Error while enumerating installed packages.") File "c:\Users\kimk1\.vscode\extensions\ms-python.debugpy-2024.0.0-win32-x64\bundled\libs\debugpy/..\debugpy\common\log.py", line 215, in swallow_exception _exception(format_string, *args, **kwargs)

 

Hello world

 

이런식으로 출력되는데 해결방법은 의외로 간단하다.https://github.com/microsoft/debugpy/issues/1379

 

Error while enumerating installed packages. · Issue #1379 · microsoft/debugpy

Describe the bug Steps to Reproduce Create a Python Application project. Type import debugpy print(debugpy.__version__) debugpy.listen(("localhost", 5678)) debugpy.wait_for_client() print('hello') ...

github.com

pip install importlib-metadata 업데이트를 하면된다.

 

importlib-metadata는 Python 패키지 중 하나로, 버전 3.8 이상의 Python에서는 표준 라이브러리로 포함되어 있어 일반적으로 설치가 필요하지 않지만 

만약 버전이 낮은 Python을 사용하거나 특정 상황에서 문제가 발생한다면, 최신 버전의 importlib-metadata를 설치하면 해결된다.