[New-bugs-announce] [issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'
Klaus Ethgen
report at bugs.python.org
Sun Jan 3 09:09:35 EST 2021
New submission from Klaus Ethgen <Klaus at Ethgen.de>:
I encountered the bug when installing a package with `python3 setup.py install --user`. After that, a second installation failed with this stack trace:
```
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2191, in _handle_ns
loader = importer.find_spec(packageName).loader
AttributeError: 'zipimporter' object has no attribute 'find_spec'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/klaus/devel/upstream/pass-git-helper/setup.py", line 1, in <module>
from setuptools import setup
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 16, in <module>
import setuptools.version
File "/usr/lib/python3/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3239, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3222, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3264, in _initialize_master_working_set
tuple(
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3265, in <genexpr>
dist.activate(replace=False)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2780, in activate
declare_namespace(pkg)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2279, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2196, in _handle_ns
loader = importer.find_spec(packageName)
AttributeError: 'zipimporter' object has no attribute 'find_spec'
```
This error happens now also with different tools.
Solution is to `rm -fr ~/.local/lib`. But the next installation triggers the bug again.
The only solution is to install via `python3 setup.py install --user --old-and-unmanageable`.
When I look into the code of zipimport(er), I do not see any find_spec only the old find_loader.
Despite it is a core library, this must be fixed! And with that the name should match the name of the py file to make it able to find the relevant file.
----------
components: Library (Lib)
messages: 384279
nosy: mowgli
priority: normal
severity: normal
status: open
title: AttributeError: 'zipimporter' object has no attribute 'find_spec'
type: crash
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42818>
_______________________________________
More information about the New-bugs-announce
mailing list