[issue38342] ImportError: cannot import name 'MetadataPathFinder' from 'importlib.metadata'

Jason R. Coombs report at bugs.python.org
Wed Oct 2 10:09:30 EDT 2019


Jason R. Coombs <jaraco at jaraco.com> added the comment:

I've confirmed that the `metadata` directory doesn't exist in the repo. It also doesn't appear on my Python 3.8.0b4 installation on macOS:

```
cpython master $ ls /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/                                               
__init__.py            _bootstrap.py          abc.py                 metadata.py            util.py
__pycache__            _bootstrap_external.py machinery.py           resources.py
cpython master $ python3.8 -V                                                                                                                
Python 3.8.0b4
```

I installed b4 clean. I also installed 3.8.0rc1 over 3.8.0b4 and everything is fine.

It's possible that installing 3.8.0b4 over 3.8.0b3 would leave the old package lingering. Can you confirm that's how 3.8.0rc1 was installed?

I've crafted this command which should correct the situation in such an environment::

python -c "import importlib.metadata, shutil, pathlib; file = pathlib.Path(importlib.metadata.__file__); str(file).endswith('__init__.py') and shutil.rmtree(file.parent) and print('removed', file.parent)"

Please give that a try and see if it corrects the condition.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38342>
_______________________________________


More information about the Python-bugs-list mailing list