Bug 259981 - devel/py-setuptools_scm: Fix incorrect *_DEPENDS, causing devel/py-pyparsing (and others) Fails to configure: The 'packaging>=20.0' distribution was not found
Summary: devel/py-setuptools_scm: Fix incorrect *_DEPENDS, causing devel/py-pyparsing ...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kai Knoblich
URL:
Keywords: needs-patch, regression
Depends on:
Blocks:
 
Reported: 2021-11-22 11:02 UTC by Ivan Rozhuk
Modified: 2021-11-25 17:59 UTC (History)
8 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2021-11-22 11:02:55 UTC
===> Fetching all distfiles required by py38-pyparsing-3.0.6 for building
===>  Extracting for py38-pyparsing-3.0.6
=> SHA256 Checksum OK for pyparsing-3.0.6.tar.gz.
===>  Patching for py38-pyparsing-3.0.6
===>   py38-pyparsing-3.0.6 depends on package: py38-setuptools>0 - found
===>   py38-pyparsing-3.0.6 depends on file: /usr/local/bin/python3.8 - found
===>   py38-pyparsing-3.0.6 depends on file: /usr/local/bin/ccache - found
===>  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
Comment 1 Matthew Kern 2021-11-22 15:23:32 UTC
Trying to install py-packaging with portmaster will fail, since py-pyparsing is listed as a runtime requirement for py-packaging (so portmaster tries to run the py-pyparsing build before the install step from py-packaging).

I was able to proceed by running 'make install clean' within /usr/ports/devel/py-packaging, then within /usr/ports/devel/py-pyparsing, then continuing with the rest of the portmaster step I was completing.
Comment 2 Ivan Rozhuk 2021-11-24 09:48:08 UTC
Probably this is not py-pyparsing error.

Same error was with other python ports until I run "pkg autoremove", it remove:
	py38-Babel: 2.9.1
	py38-Jinja2: 3.0.1
	py38-beaker: 1.11.0
	py38-cython: 0.29.24
	py38-docutils: 0.17.1,1
	py38-html5lib: 1.0.1
	py38-lxml: 4.6.4
	py38-mako: 1.0.14_1
	py38-markupsafe: 2.0.1
	py38-ply: 3.11
	py38-pyaes: 1.6.1
	py38-pyparsing: 3.0.4
	py38-pytest-runner: 5.3.1
	py38-setuptools_scm: 6.3.2
	py38-tomli: 1.2.2
	py38-webencodings: 0.5.1
	py38-wheel: 0.36.2

Somehow py38-packaging was not installed, but py38-setuptools_scm requires this.
Removing py38-setuptools_scm - fix issue for me.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-11-25 06:03:39 UTC
Upstream declares:

  ./work-py39/setuptools_scm-6.3.2/pyproject.toml:    "packaging>=20.0"

But devel/pysetuptools_scm declares packaging as a RUN_DEPENDS, but should be a BUILD_DEPENDS.

Workaround until resolved: install devel/py-packaging manually
Comment 4 Kubilay Kocak freebsd_committer freebsd_triage 2021-11-25 06:05:11 UTC
(In reply to Kubilay Kocak from comment #3)

Clarifying, upstream declares:

[build-system]
requires=..., "packaging>=20.0",...
Comment 5 Kai Knoblich freebsd_committer 2021-11-25 17:59:16 UTC
The problem occurs in environments where devel/py-setuptools_scm is installed and devel/py-packaging is also updated together with other Python ports during an upgrade run via portmaster.

The old version of devel/py-packaging will be removed at some point and the new version will be installed too late which will then leads to the issue described in comment #2.

This is because devel/py-packaging is required for run time [1] by devel/py-setuptools_scm and the latter one is very interlocked with devel/py-setuptools.  It's executed together almost every time a Python port is built and will fail if a dependency is missing during run time.

The issue can be reproduced via:

- Install/Build devel/py-pyparsing 3.0.4
- Install/Build devel/py-packaging 21.2_1
- Install/Build devel/py-setuptools_scm
- Apply patches to update devel/py-packaging to 21.3 and devel/py-pyparsing to 3.0.6
- Try to upgrade the ports with portmaster

The whole problem will most likely recur the next time devel/py-packaging is updated.  Probably a long-term solution would be if portmaster treats ports like devel/py-setuptools* and their dependencies with higher priority over other Ports during an upgrade run.

(In reply to Kubilay Kocak from comment #3)

I'll add devel/py-packaging to BUILD_DEPENDS as it is in "pyproject.toml" and you have already mentioned it although it's not the solution to the problem reported with devel/py-pyparsing as described above.

--
[1] https://github.com/pypa/setuptools_scm/blob/v6.3.2/setup.cfg#L30