zopefoundation / Zope

Zope is an open-source web application server.
https://zope.readthedocs.io
Other
357 stars 101 forks source link

PackageNotFoundError: Paste #1150

Closed techtake closed 1 year ago

techtake commented 1 year ago

PROBLEM REPORT

I got an error of PackageNotFoundError when I executed bin/runwsgi -v etc/zope.ini.

Error log

zope@zope5 ~/Python3_11_2/Zope-5.8.4
$ bin/runwsgi -v etc/zope.ini
Traceback (most recent call last):
  File "/home/zope/.pyenv/versions/3.11.2/lib/python3.11/importlib/metadata/__init__.py", line 563, in from_name
    return next(cls.discover(name=name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/zope/Python3_11_2/Zope-5.8.4/bin/runwsgi", line 92, in <module>
    sys.exit(Zope2.Startup.serve.main())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/src/Zope2/Startup/serve.py", line 251, in main
    return command.run()
           ^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/src/Zope2/Startup/serve.py", line 189, in run
    app = self.loadapp(app_spec, name=app_name, relative_to=base,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/src/Zope2/Startup/serve.py", line 220, in loadapp
    return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 248, in loadapp
    return loadobj(APP, uri, name=name, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 270, in loadobj
    context = loadcontext(
              ^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 295, in loadcontext
    return _loaders[scheme](
           ^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 326, in _loadconfig
    return loader.get_context(object_type, name, global_conf)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 452, in get_context
    context = self._pipeline_app_context(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 575, in _pipeline_app_context
    context.filter_contexts = [
                              ^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 576, in <listcomp>
    self.get_context(FILTER, name, global_conf) for name in pipeline[:-1]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 461, in get_context
    context = self._context_from_use(
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 488, in _context_from_use
    context = self.get_context(object_type, name=use, global_conf=global_conf)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 403, in get_context
    return loadcontext(
           ^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 295, in loadcontext
    return _loaders[scheme](
           ^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 334, in _loadegg
    return loader.get_context(object_type, name, global_conf)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 638, in get_context
    entry_point, protocol, ep_name = self.find_egg_entry_point(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg/paste/deploy/loadwsgi.py", line 658, in find_egg_entry_point
    dist = importlib_metadata.distribution(self.spec)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/.pyenv/versions/3.11.2/lib/python3.11/importlib/metadata/__init__.py", line 981, in distribution
    return Distribution.from_name(distribution_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/zope/.pyenv/versions/3.11.2/lib/python3.11/importlib/metadata/__init__.py", line 565, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for Paste

What I did:

I installed Zope and made an instance, according to the documentation. https://zope.readthedocs.io/en/latest/INSTALL.html

$ wget https://pypi.org/packages/source/Z/Zope/Zope-5.8.4.tar.gz
$ tar xfvz Zope-5.8.4.tar.gz
$ cd Zope-5.8.4
$ python -m venv .
$ bin/pip install -U pip wheel zc.buildout
$ bin/buildout
$ bin/mkwsgiinstance -d .

and

$ bin/runwsgi -v etc/zope.ini

Then, the error occurred. When I did the same process with Zope 5.8, I was able to run Zope.

What version of Python and Zope/Addons I am using:

OS: Debian11 Python: 3.11.2 Zope: 5.8.1, 5.8.3, 5.8.4(I didn't check 5.8.2).

buildout.cfg

[buildout]
extensions = mr.developer
allow-picked-versions = false
develop = .
extends =
    sources.cfg
    versions.cfg
installed = .installed.cfg
parts =
    test
    zopescripts
    alltests
    allpy
    sphinx
    checkversions
    requirements
sources-dir = develop
auto-checkout =

[testenv]
PYTHONHASHSEED = random

[test]
recipe = zc.recipe.testrunner
script = test
environment = testenv
initialization =
    import sys
    import warnings
    warnings.simplefilter('default')
eggs = Zope

[zopescripts]
recipe = zc.recipe.egg
interpreter = zopepy
eggs =
    Zope[wsgi]

[alltests]
recipe = zc.recipe.testrunner
script = alltests
environment = testenv
eggs =
    AccessControl
    Acquisition
    DateTime
    DocumentTemplate
    ExtensionClass
    MultiMapping
    Persistence
    zExceptions
    Zope
# Test optional dependencies.
    five.localsitemanager
    Missing
    Products.BTreeFolder2
    Products.ZCatalog
    Record

[allpy]
recipe = zc.recipe.egg
eggs = ${alltests:eggs}
interpreter = allpy

[make-docs]
recipe = collective.recipe.template
input = inline:
    #!/bin/sh
    cd ${buildout:directory}/docs
    make html
output = ${buildout:directory}/bin/make-docs
mode = 755

[sphinx]
=> make-docs
recipe = zc.recipe.egg
eggs =
    Zope[docs]
    Sphinx
scripts =
    sphinx-build

[checkversions]
recipe = zc.recipe.egg
eggs = z3c.checkversions [buildout]

[requirements]
recipe = plone.recipe.command
command =
    ${zopescripts:bin-directory}/${zopescripts:interpreter} util.py
update-command = ${:command}
stop-on-error = yes

bin/runwsgi

#!/home/zope/Python3_11_2/Zope-5.8.4/bin/python

import sys
sys.path[0:0] = [
  '/home/zope/Python3_11_2/Zope-5.8.4/src',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/AccessControl-6.2-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Acquisition-5.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/DateTime-5.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/DocumentTemplate-4.4-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/ExtensionClass-5.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/MultiMapping-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Persistence-4.0.post1-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zExceptions-4.3-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/five.localsitemanager-4.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Missing-4.2-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Products.BTreeFolder2-5.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Products.ZCatalog-7.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Record-4.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.testing-5.0.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.schema-7.0.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.interface-6.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.globalrequest-2.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.dottedname-6.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.deferredimport-4.4-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/ZODB-5.8.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/RestrictedPython-6.2-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/BTrees-5.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.lifecycleevent-4.4-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.event-4.6-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.container-5.1-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.site-4.6.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.location-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.component-6.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/persistent-5.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/multipart-0.2.4-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.viewlet-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.traversing-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.testbrowser-6.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.tales-5.2-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.tal-5.0.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.size-4.4-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.sequencesort-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.security-6.1-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.publisher-6.1.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.ptresource-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.proxy-5.0.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.processlifetime-3.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.pagetemplate-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.i18nmessageid-6.0.1-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.i18n-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.exceptions-4.6-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.datetime-5.0.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.contenttype-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.contentprovider-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.configuration-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.browserresource-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.browserpage-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.browsermenu-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.browser-3.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/z3c.pt-4.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/waitress-2.1.2-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/transaction-3.1.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/ZConfig-4.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/PasteDeploy-3.0.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/Chameleon-4.0.0-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.structuredtext-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/roman-4.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/pytz-2023.3-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/AuthEncoding-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zodbpickle-3.0.1-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zc.lockfile-3.0.post1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/six-1.16.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.filerepresentation-6.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.cachedescriptors-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.deprecation-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.annotation-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/zope.hookable-5.4-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/cffi-1.15.1-py3.11-linux-x86_64.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/WSGIProxy2-0.5.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/soupsieve-2.4.1-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/beautifulsoup4-4.12.2-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/WebTest-3.0.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/python_gettext-5.0-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/pycparser-2.21-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/eggs/WebOb-1.8.7-py3.11.egg',
  '/home/zope/Python3_11_2/Zope-5.8.4/lib/python3.11/site-packages',
  ]

import Zope2.Startup.serve

if __name__ == '__main__':
    sys.exit(Zope2.Startup.serve.main())
dataflake commented 1 year ago

You should not use the built-in configuration, I have changed the installation docs accordingly: https://zope.readthedocs.io/en/latest/INSTALL.html#built-in-standard-buildout-configuration

Essentially, the default configuration is not pulling in Paste correctly. The minimal configuration in the section below will do that.

techtake commented 1 year ago

I got it. Thank you for changing the doc.