skip to Main Content

My long-successful VSCode Python setup broke inexplicably.

Please, what does the error below mean?
First the recommended Python 3.12 can’t find _tkinter. I try an older installed version and get this. I can’t use pip either, it says "externally managed environment". I’m lost.

%  cd /Users/ken/Teaching/Python2024 ; /usr/bin/env /opt/local/bin/python3.9 /Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher 64660 -- /Users/ken/Teaching/Python2024/turtle1.py 
E+00000.193: Error while enumerating installed packages.
             
 Traceback (most recent call last):
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../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 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
     return _run_code(code, main_globals, None,
   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
     exec(code, run_globals)
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 91, in <module>
     main()
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 21, in main
     log.describe_environment("debugpy.launcher startup environment:")
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py", line 369, in describe_environment
     info("{0}", get_environment_description(header))
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py", line 363, in get_environment_description
     swallow_exception("Error while enumerating installed packages.")
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py", line 215, in swallow_exception
     _exception(format_string, *args, **kwargs)

E+00000.030: Error while enumerating installed packages.
             
 Traceback (most recent call last):
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../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 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
     return _run_code(code, main_globals, None,
   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
     exec(code, run_globals)
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
     cli.main()
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 415, in main
     api.ensure_logging()
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/api.py", line 61, in ensure_logging
     log.describe_environment("Initial environment:")
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/common/log.py", line 369, in describe_environment
     info("{0}", get_environment_description(header))
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/common/log.py", line 363, in get_environment_description
     swallow_exception("Error while enumerating installed packages.")
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/common/log.py", line 215, in swallow_exception
     _exception(format_string, *args, **kwargs)

             

E+00000.225: Error while enumerating installed packages.
             
 Traceback (most recent call last):
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../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 "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
     return _run_code(code, main_globals, None,
   File "/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
     exec(code, run_globals)
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 39, in <module>
     cli.main()
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
     run()
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 281, in run_file
     log.describe_environment("Pre-launch environment:")
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/common/log.py", line 369, in describe_environment
     info("{0}", get_environment_description(header))
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/common/log.py", line 363, in get_environment_description
     swallow_exception("Error while enumerating installed packages.")
   File "/Users/ken/.vscode/extensions/ms-python.debugpy-2023.3.13341006-darwin-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/common/log.py", line 215, in swallow_exception
     _exception(format_string, *args, **kwargs)

2

Answers


  1. At least for the message in the trace you showed, it seems extremely similar (at least by the trace) to Error while enumerating installed packages.
    #1379
    , which- though it’s about debugpy for Visual Studio. If it’s the same issue, according to the maintainers, you can just ignore that message and debugpy will still work fine. That log message should be assigned to the "info" log level in later versions of debugpy.

    Login or Signup to reply.
  2. fixed after installing importlib-metadata and debugpy in my `venv

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search