Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'PathDistribution' object has no attribute 'name' #1643

Open
kazeki opened this issue Aug 2, 2024 · 4 comments
Open

'PathDistribution' object has no attribute 'name' #1643

kazeki opened this issue Aug 2, 2024 · 4 comments

Comments

@kazeki
Copy link

kazeki commented Aug 2, 2024

python version:

3.8.19

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
        }
    ]
}

error message

E+00000.072: Error while enumerating installed packages.
             
             Traceback (most recent call last):
               File "/home/xhdev/.vscode/extensions/ms-python.debugpy-2024.0.0-linux-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 "/home/xhdev/dev/miniconda3/envs/ML/lib/python3.8/runpy.py", line 194, in _run_module_as_main
                 return _run_code(code, main_globals, None,
               File "/home/xhdev/dev/miniconda3/envs/ML/lib/python3.8/runpy.py", line 87, in _run_code
                 exec(code, run_globals)
               File "/home/xhdev/.vscode/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 91, in <module>
                 main()
               File "/home/xhdev/.vscode/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/__main__.py", line 21, in main
                 log.describe_environment("debugpy.launcher startup environment:")
               File "/home/xhdev/.vscode/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py", line 370, in describe_environment
                 info("{0}", get_environment_description(header))
               File "/home/xhdev/.vscode/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py", line 364, in get_environment_description
                 swallow_exception("Error while enumerating installed packages.")
               File "/home/xhdev/.vscode/extensions/ms-python.debugpy-2024.0.0-linux-x64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/common/log.py", line 215, in swallow_exception
                 _exception(format_string, *args, **kwargs)
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python-debugger Aug 5, 2024
@yedemon
Copy link

yedemon commented Aug 6, 2024

I seem to have the same problem. But in my case, it seems only to be a "warning" message while not affecting the debug process, still annoying. Oh, I'm just happened to use miniconda too.

@yedemon
Copy link

yedemon commented Aug 29, 2024

I did some look into this crazy.. My only guess is it might has something related with packages installed. One of my project has those packages installed has this problem, while the others don't..

The env has the problem.
#>pip list
Package Version


contourpy 1.1.1
cycler 0.12.1
fonttools 4.53.1
kiwisolver 1.4.5
matplotlib 3.7.5
numpy 1.24.4
opencv-python 4.10.0.84
packaging 24.1
pillow 10.4.0
pip 24.2
pyparsing 3.1.4
python-dateutil 2.9.0.post0
setuptools 72.1.0
six 1.16.0
wheel 0.43.0
zipp 3.20.1

The env doesn't have the problem.
#>pip list
Package Version


asgiref 3.8.1
Django 5.1
image 1.5.33
numpy 2.1.0
opencv-python 4.10.0.84
pillow 10.4.0
pip 24.2
scipy 1.14.1
setuptools 72.1.0
six 1.16.0
sqlparse 0.5.1
typing_extensions 4.12.2
wheel 0.43.0

And both of the envs are brought up by "conda create --name *** python=3.8"

Dunno if these info will mislead, I am only want to help..

@yedemon
Copy link

yedemon commented Aug 29, 2024

Ek.. a few struggle😒. After installing a package called "importlib_metadata==8.4.0" to the project which has the problem. The message "'PathDistribution' object has no attribute 'name'" disappears..

Try: pip install "importlib_metadata==8.4.0"

I hope this works for your situation.❤

Still don't know where the problem lies.

@judej judej assigned debonte and unassigned debonte Oct 14, 2024
@marc22alain
Copy link

marc22alain commented Jan 5, 2025

Try: pip install "importlib_metadata==8.4.0"

I found exactly the same issue with VS Code v1.96.2 on MacOS Big Sur, and Python v3.8.5 managed with pyenv.
This solution worked for me too.

For reference:

E+00000.072: Error while enumerating installed packages.
             
             Traceback (most recent call last):
               File "/Volumes/Clarus/marc_alain/.vscode/extensions/ms-python.debugpy-2024.0.0-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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants