[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-07 Thread Klaus Ethgen


Klaus Ethgen  added the comment:

I also tested the original bug and it seems to be gone.

--
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-07 Thread Klaus Ethgen


Klaus Ethgen  added the comment:

You are right.

Generally I have the installation on devuan Linux, the unstable tree.

But... In 2019-03-13 I started to patch this file as many python scripts 
started to fail due to the fact that they had the find_spec implemented. This 
was still true in Apr 2020, when I had to renew the patch. And let me say, many 
failed; not only the egg part.

I don't know where I found the patch at first but it worked now for nearly two 
years. I did revert it now and for the moment, the scripts that I remember was 
failing, seems to work now.

Let me say that this find_spec/find_module stuff is (or was) a bit of a mess.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-07 Thread Desmond Cheong


Desmond Cheong  added the comment:

Could you provide some information about the system you're running this on? I 
might be wrong, but this does seem like an issue with this copy of setuptools. 
From the Traceback, it seems that line 2196 of 
/usr/lib/python3/dist-packages/pkg_resources/__init__.py runs `loader = 
importer.find_spec(packageName)` when trying to handle the AttributeError 
exception. However, this line should instead have run `loader = 
importer.find_module(packageName)` based on the source code 
https://github.com/pypa/setuptools/blob/95a9c474d30acc729b536f9ad88ead7efab62c5d/pkg_resources/__init__.py#L2190-L2197

Git blame also tells me that this fall-back has been implemented for a few 
years now.

It also appears that the zipimporter.find_spec method is not implemented in 
Python3.9 and earlier. However, zipimporter.find_module has been implemented 
for at least Python3.8 onwards, if not earlier 
(https://github.com/python/cpython/blob/ca8e96d1edbeb536f58da91e607082463398fce1/Lib/zipimport.py#L139-L150).

--
nosy: +desmondcheongzx

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-05 Thread Klaus Ethgen


Klaus Ethgen  added the comment:

I don't know if that is an issue with zipimporter or an issue with a version of 
setuptools.

My knowledge of python is very limited.

But from what I can see in the backtrace it is missing find_spec. How ever that 
reverting is or should be implemented, it seams to be obviously that it is not 
working.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-04 Thread J.D. Rudie


J.D. Rudie  added the comment:

Is this an issue with zipimporter, or an issue with a version of setuptools? On 
the latest version of setuptools, find_spec reverts to find_module, which 
should be implemented in the 3.9 version of zipimporter unless I'm 
misunderstanding the issue.

--
nosy: +rudiejd

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42818] AttributeError: 'zipimporter' object has no attribute 'find_spec'

2021-01-03 Thread Klaus Ethgen


New submission from Klaus Ethgen :

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 

 
from setuptools import setup
  
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 16, in 

  
import setuptools.version   
  
  File "/usr/lib/python3/dist-packages/setuptools/version.py", line 1, in 


import pkg_resources
  
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3239, 
in  
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 
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: Att