ModuleNotFoundError: No module named 'zope.deferredimport'

I have a Plone 5.2.1 buildout with only add-on. The instance won't start although zope.deferredimport is included in the bin/instance script:

 bin/instance adduser admin admin
Traceback (most recent call last):
  File "/home/ajung/src/xmldirector.connector/parts/instance/bin/interpreter", line 285, in <module>
    exec(_val)
  File "<string>", line 1, in <module>
  File "/home/ajung/.buildout/eggs/Zope-4.4-py3.7.egg/Zope2/__init__.py", line 18, in <module>
    from zope.deferredimport import deprecated
ModuleNotFoundError: No module named 'zope.deferredimport'

 grep deferred bin/instance 
  '/home/ajung/.buildout/eggs/zope.deferredimport-4.3.1-py3.7.egg',

Cool stuff!
Is import zope working? is import zope.deferredimport working?
If not it might be a bad mix of buildout installed packages and virtualenv install packages (at least I saw something similar in the past).
If yes what happens if you put a pdb in the __init__.py of zope.deferredimport?

1 Like

Now having the same issue on a different Plone 5.2.1 site with bin/instance debug.

@alert I can use pdb inside the __init__.py but I don't see any error/issue here.

Further investation: the import of zope.deferredimport happens twice. The first one is working, the second fails. Interesting that zope is different during the second import (which makes no sense to me).

bin/zeoclient adduser admin admin
[18] > /home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Zope-4.1.3-py3.7.egg/Zope2/__init__.py(18)<module>()
-> from zope.deferredimport import deprecated
(Pdb++) import zope
(Pdb++) pp zope
<module 'zope' from '/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/zope.hookable-4.2.0-py3.7-linux-x86_64.egg/zope/__init__.py'>
(Pdb++) c
[13] > /home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Zope-4.1.3-py3.7.egg/Zope2/__init__.py(18)<module>()
-> from zope.deferredimport import deprecated
(Pdb++) import zope
(Pdb++) pp zope
<module 'zope' (namespace)>
(Pdb++) c
Traceback (most recent call last):
  File "/home/ajung/sandboxes/ugent-portaal-plone-4x/parts/zeoclient/bin/interpreter", line 349, in <module>
    exec(_val)
  File "<string>", line 1, in <module>
  File "/home/ajung/sandboxes/ugent-portaal-plone-4x/eggs/Zope-4.1.3-py3.7.egg/Zope2/__init__.py", line 18, in <module>
    from zope.deferredimport import deprecated
ModuleNotFoundError: No module named 'zope.deferredimport'

Bug report

Solved: https://github.com/zopefoundation/Zope/issues/856#issuecomment-651079969

That's what I told you :wink:

1 Like