Bug 259993 - devel/py-pyparsing: build failure: pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not found and is required by the application
Summary: devel/py-pyparsing: build failure: pkg_resources.DistributionNotFound: The 'p...
Status: Closed DUPLICATE of bug 259981
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-23 07:17 UTC by O. Hartmann
Modified: 2021-12-09 14:55 UTC (History)
14 users (show)

See Also:
bugzilla: maintainer-feedback? (sunpoet)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2021-11-23 07:17:30 UTC
Host is recent 13-STABLE (13.0-STABLE FreeBSD 13.0-STABLE #41 stable/13-n248173-d16fbc488e6: Mon Nov 22 17:03:05 CET 2021 amd64), ports tree is up to date, build is traditional (make), port 

devel/py-pyparsing

is failing to build (similar to devel/py-packaging failure):

[...]
===>  Configuring for py38-pyparsing-3.0.6
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 23, in <module>
    setup(  # Distribution meta-data
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.8/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 455, in __init__
    _Distribution.__init__(self, {
  File "/usr/local/lib/python3.8/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 800, in finalize_options
    for ep in sorted(eps, key=by_order):
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 799, in <lambda>
    eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in load
    self.require(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not found and is required by the application
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/py-pyparsing
*** Error code 1
Comment 1 Cameron 2021-11-23 17:01:07 UTC
Seeing the same thing for devel/py-pycparser:

===>>> All >> py38-pycparser-2.20 (1/3)
^[]0;portmaster: All >> py38-pycparser-2.20 (1/3)^G
===>  Cleaning for py38-pycparser-2.21
===>  License BSD3CLAUSE accepted by the user
===>   py38-pycparser-2.21 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by py38-pycparser-2.21 for building
===>  Extracting for py38-pycparser-2.21
=> SHA256 Checksum OK for pycparser-2.21.tar.gz.
===>  Patching for py38-pycparser-2.21
===>   py38-pycparser-2.21 depends on package: py38-setuptools>0 - found
===>   py38-pycparser-2.21 depends on file: /usr/local/bin/python3.8 - found
===>  Configuring for py38-pycparser-2.21
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 35, in <module>
    setup(
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.8/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 455, in __init__
    _Distribution.__init__(self, {
  File "/usr/local/lib/python3.8/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 800, in finalize_options
    for ep in sorted(eps, key=by_order):
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 799, in <lambda>
    eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in load
    self.require(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not found and is required by the application
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-pycparser

===>>> make build failed for devel/py-pycparser@py38
===>>> Aborting update

===>>> Update for devel/py-pycparser@py38 failed
===>>> Aborting update


===>>> You can restart from the point of failure with this command line:
       portmaster <flags> devel/py-pycparser@py38 textproc/py-snowballstemmer@py38 devel/py-pyparsing@py38
Comment 2 Cameron 2021-11-23 21:26:59 UTC
(In reply to Cameron from comment #1)

This is on 13.0-RELEASE-p4.
Comment 3 Tom 2021-11-26 00:39:36 UTC
I too have this error on 13.0-RELEASE-p5

===>  Configuring for py37-pyparsing-3.0.6
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 55, in <module>
    "Programming Language :: Python :: Implementation :: PyPy",
  File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.7/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 456, in __init__
    k: v for k, v in attrs.items()
  File "/usr/local/lib/python3.7/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 800, in finalize_options
    for ep in sorted(eps, key=by_order):
  File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 799, in <lambda>
    eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2449, in load
    self.require(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not found and is required by the application
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/py-pyparsing
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-pyparsing
Comment 4 Koichiro Iwao freebsd_committer freebsd_triage 2021-11-26 02:05:51 UTC
I think there's a circular dependency in devel/py-pyparsing versus devel/py-packaging.


  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'packaging>=20.0' distribution was not found and is required by the application
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/devel/py-pyparsing
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-pyparsing

  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pyparsing!=3.0.5,>=2.0.2' distribution was not found and is required by packaging
*** Error code 1

Stop.
make: stopped in /usr/ports/devel/py-packaging
Comment 5 Joachim 2021-11-28 06:52:19 UTC
I have the same error using Freebsd 12.2
Comment 6 Ekkehard 'Ekki' Gehm 2021-12-03 10:00:06 UTC
Makefile needs a Line...


26d25
< BUILD_DEPENDS=                ${PYTHON_PKGNAMEPREFIX}packaging>=20:devel/py-packaging@${PY_FLAVOR}
Comment 7 Koichiro Iwao freebsd_committer freebsd_triage 2021-12-04 09:10:07 UTC
(In reply to Ekkehard 'Ekki' Gehm from comment #6)
It doesn't solve the circular dependency for me because devel/py-packaging depends on devel/py-pyparsing. 

devel/py-pyparsing -> devel/py-packaging -> devel/py-pyparsing 



diff --git a/devel/py-pyparsing/Makefile b/devel/py-pyparsing/Makefile                                                                                                                                          index edb31296a115..00b949845dd0 100644                                                                                                                                                                         --- a/devel/py-pyparsing/Makefile                                                                                                                                                                               +++ b/devel/py-pyparsing/Makefile
@@ -20,6 +20,8 @@ NO_ARCH=      yes
 OPTIONS_DEFINE=        DIAGRAMS                                                                                                                                                                                 DIAGRAMS_DESC= Diagram support                                                                                                                                                                                                                                                                                                                                                                                                 +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}packaging>=20:devel/py-packaging@${PY_FLAVOR}                                                                                                                            +                                                                                                                                                                                                                DIAGRAMS_RUN_DEPENDS=  ${PYTHON_PKGNAMEPREFIX}Jinja2>=0:devel/py-Jinja2@${PY_FLAVOR} \                                                                                                                                                 ${PYTHON_PKGNAMEPREFIX}railroad-diagrams>=0:graphics/py-railroad-diagrams@${PY_FLAVOR}

===>   py38-pyparsing-3.0.6 depends on package: py38-packaging>=20 - not found
===>   py38-packaging-21.3 depends on package: py38-setuptools>0 - found
===>   py38-packaging-21.3 depends on file: /usr/local/bin/python3.8 - found
===>   py38-packaging-21.3 depends on file: /usr/local/bin/ccache - found
===>  Configuring for py38-packaging-21.3
Traceback (most recent call last):
  File "<string>", line 1, in <module>                                                                                                                                                                            File "setup.py", line 40, in <module>
    setup(                                                                                                                                                                                                        File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup                                                                                                                          return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.8/distutils/core.py", line 108, in setup                                                                                                                                             _setup_distribution = dist = klass(attrs)                                                                                                                                                                     File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 455, in __init__
    _Distribution.__init__(self, {                                                                                                                                                                                File "/usr/local/lib/python3.8/distutils/dist.py", line 292, in __init__                                                                                                                                          self.finalize_options()                                                                                                                                                                                       File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 800, in finalize_options
    for ep in sorted(eps, key=by_order):                                                                                                                                                                          File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 799, in <lambda>                                                                                                                           eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))                                                                                                                                         File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in load                                                                                                                       self.require(*args, **kwargs)                                                                                                                                                                                 File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 772, in resolve                                                                                                                     raise DistributionNotFound(req, requirers)                                                                                                                                                                  pkg_resources.DistributionNotFound: The 'pyparsing!=3.0.5,>=2.0.2' distribution was not found and is required by packaging
*** Error code 1                                                                                                                                                                                                                                                                                                                                                                                                                Stop.                                                                                                                                                                                                           make[2]: stopped in /home/meta/FreeBSD/ports/git/devel/py-packaging
*** Error code 1                                                                                                                                                                                                                                                                                                                                                                                                                Stop.                                                                                                                                                                                                           make[1]: stopped in /home/meta/FreeBSD/ports/git/devel/py-pyparsing
*** Error code 1                                                                                                                                                                                                                                                                                                                                                                                                                Stop.                                                                                                                                                                                                           make: stopped in /home/meta/FreeBSD/ports/git/devel/py-pyparsing
Comment 8 Koichiro Iwao freebsd_committer freebsd_triage 2021-12-04 09:32:51 UTC
I'm still not sure what is the root cause however uninstalling py38-setuptools_scm without modifying Makefie did the trick for me.

> pkg remove py38-setuptools_scm
Comment 9 Po-Chuan Hsieh freebsd_committer freebsd_triage 2021-12-04 09:46:07 UTC
This is totally a portmaster issue (wrong order of build, install and deinstall).
The python dependencies are all correct.
py-pyparsing DOES NOT REQUIRE py-packaging.

(In reply to Koichiro Iwao from comment #8)

py-setuptools_scm is where 'packaging>=20.0' came from.
Thus uninstalling py-setuptools_scm is a workaround.
Comment 10 Stefan Eßer freebsd_committer freebsd_triage 2021-12-04 22:33:46 UTC
No, this has nothing to do at all with portmaster, as is obvious from the reports that ran into this situation without using portmaster.

This is actually a duplicate of PR 259981, and I'll mark it as such.

The problem is that py-setuptools_scm depends on both py-pyparsing and py-packaging, and these two ports are correctly installed with py-setuptools_scm.

Both py-pyparsing and py-packaging cannot depend on py-setuptools_scm, as that would be a circular dependency.

But if either or both of py-pyparsing and py-packaging are removed, but py-setuptools_scm persists, then the missing ports can no longer be built.

The configure phase will try to execute py-setuptools_scm, which fails of one of the run dependencies is missing. And that terminates the build of the missing dependency, despite it not really depending on py-setuptools_scm (as that would be a circular dependency).

Either py-setuptools_scm should only be executed for ports that actually depend on it (not realistic), or a failure of py-setuptools_scm due to a missing py-pyparsing or py-packaging should not make their setup.py fail, perhaps by passing an option that prevents invocation of py-setuptools_scm for these two ports.

*** This bug has been marked as a duplicate of bug 259981 ***
Comment 11 Koichiro Iwao freebsd_committer freebsd_triage 2021-12-09 14:05:50 UTC
(In reply to Po-Chuan Hsieh from comment #9)
As Stefan already mentioned, I also think it's not portmaster issue.

I did `make install` instead of `portmaster` but got same result as comment #8.
Comment 12 Koichiro Iwao freebsd_committer freebsd_triage 2021-12-09 14:55:29 UTC

*** This bug has been marked as a duplicate of bug 259981 ***