Unable to build Python38 ports like devel/py38-pycparser and even py38-setuptools

From: Dr. Peter Voigt <pvoigt_at_uos.de>
Date: Sat, 27 Nov 2021 20:03:19 UTC
I am currently facing a strange problem when tryping to upgrade
following ports:

# pkg version -vIL=           
py38-pycparser-2.20                <   needs updating (index has 2.21)
py38-pyparsing-3.0.4               <   needs updating (index has 3.0.6)
py38-snowballstemmer-2.1.0         <   needs updating (index has 2.2.0)

All mentioned ports cannot be upgraded from ports source tree. For e.g.
py38-pycparser I get:

===>>> Starting build for devel/py-pycparser@py38 <<<===

===>>> All dependencies are up to date

===>  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
===>  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 -
===>   py38-pycparser-2.21 depends on file: /usr/local/bin/python3.8 -
===>  Configuring for py38-pycparser-2.21
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 35, in <module>
  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
  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(),
  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,
  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

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

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

===>>> You can restart from the point of failure with this command
       portmaster <flags> devel/py-pycparser@py38 

This command has been saved to ~/portmasterfail.txt

The error is the same for the remaining two other ports.

And even if I tryp to reinstall py38-setuptools I get the same error.

I am out of ideas and during my attempts to narrow down the error I
reinstalled python38 - which at least works without problems.

My Python and PIP versions are:
# pkg version |grep -iE "pip|python38"
py38-pip-20.3.4                    =
python38-3.8.12_1                  =