Bug 2324959 - missing 'jaraco.text-4.0.0.dist-info' in /usr/lib/python3.9/site-packages/
Summary: missing 'jaraco.text-4.0.0.dist-info' in /usr/lib/python3.9/site-packages/
Keywords:
Status: NEW
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: python-jaraco-text
Version: epel9
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Ondrej Mosnáček
QA Contact:
URL:
Whiteboard:
Depends On: 2338247
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-11-10 00:21 UTC by Joao Eduardo Luis
Modified: 2025-08-25 01:10 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github cherrypy cherrypy pull 1993 0 None Merged Replace the use of `pkg_resources` with `importlib.metadata` 2025-01-15 18:02:27 UTC
Github pypa setuptools issues 3146 0 None open [BUG] pkg_resources do not handle "new" escaping of .dist-info names correctly 2025-01-15 16:50:33 UTC

Description Joao Eduardo Luis 2024-11-10 00:21:46 UTC
Description of problem:

Problem is seen when trying to use 'CherryPy' (from 'python3-cherrypy', version 18.6.1-2). CherryPy has an indirect dependency on 'jaraco-text', via 'jaraco-collections'.

With the update to `python3-jaraco-text` version 4.0.0-2, it appears that the package no longer installs a `jaraco.text-${version}.dist-info` directory in `/usr/lib/python3.9/site-packages/`. Instead, a `jaraco_text-4.0.0.dist-info` can be found.

While this nonetheless seems to work with `importlib.metadata.requires()`, when using the (now deprecated) `pkg_resources.requires('cherrypy')`, it will fail with

> pkg_resources.DistributionNotFound: The 'jaraco.text' distribution was not found and is required by jaraco.collections

The current version of CherryPy on EPEL9 relies on the `pkg_resources` module, which in turn will fail to perform a specific check when it's loaded. CherryPy is no itself broken, but `__version__` population is.

We've found that by creating a symlink from

> /usr/lib/python3.9/site-packages/jaraco.text-4.0.0.dist-info

to

> /usr/lib/python3.9/site-packages/jaraco_text-4.0.0.dist-info

the problem is addressed. However, this feels like something the package itself should handle.


How reproducible:

This behavior is reproducible with the current version of CherryPy in epel9 (v18.6.1-2) and python3-jaraco-text v4.0.0-2.


Steps to Reproduce:

With `python3-cherrypy` version 18.6.1-2 installed, run the following in the python3 interpreter

> import cherrypy
> print(cherrypy.__version__)

it shall result in

> 'unknown'

This will happen because cherrypy is unable to obtain version information from 'pkg_resources'.

Further, running

> import pkg_resources
> for i in pkg_resources.require('cherrypy'): print(i)

results in

> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 937, in require
>     needed = self.resolve(parse_requirements(requirements))
>   File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 798, in resolve
>     dist = self._resolve_dist(
>   File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 839, in _resolve_dist
>     raise DistributionNotFound(req, requirers)
> pkg_resources.DistributionNotFound: The 'jaraco.text' distribution was not found and is required by jaraco.collections

Whereas with the symlink mentioned above we'll instead get

> CherryPy 18.6.1
> jaraco.collections 3.0.0
> zc.lockfile 2.0
> more-itertools 8.12.0
> portend 3.1.0
> cheroot 10.0.1
> six 1.15.0
> jaraco.classes 3.2.1
> jaraco.text 4.0.0
> setuptools 69.2.0
> tempora 5.0.0
> jaraco.functools 3.5.0
> more-itertools 8.12.0
> jaraco.functools 3.5.0
> jaraco-context 6.0.1
> autocommand 2.2.2
> jaraco.functools 3.5.0
> pytz 2021.1
> backports-tarfile 1.2.0

and CherryPy will indeed return its version correctly:

> import cherrypy
> print(cherrypy.__version__)

results in

> '18.6.1'

Comment 1 Ondrej Mosnáček 2025-01-15 15:49:54 UTC
It looks like a bug in hatch, which we use instead of setuptools to build the package in EPEL 9 - I reported it in bug 2338247.

Cc @fedora

Comment 2 Cristian Le 2025-01-15 16:08:19 UTC
Thanks for the CC. My understanding is that any field in the dependencies must be normalized, e.g. lowercased and special symbols changed to _ and any tools that query the project name must do a similar normalization. It seems that indeed `setuptools` does not normalize like this. Should check if there is a specific PEP that clarifies this behavior. If I understand the issue correctly, `importlib.metadata` does this correctly, but `pkg_resources` (at least the version in EPEL9) does not? Usage of `pkg_resources` outside of `setuptools` should be deprecated, but I guess adding the symlink is an appropriate solution. But first can we check of Fedora if using the same patches, that the names are again similarly normalized by hatchling and what does the most recent `pkg_resources` do in this case?

Comment 3 Ben Beasley 2025-01-15 16:50:34 UTC
It looks like https://github.com/pypa/setuptools/issues/3146 accurately describes the problem, and hatchling’s behavior appears to comply with https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode. I’m not sure what the best workaround is, unless you can port away from pkg_resources in cherrypy.

Comment 4 Cristian Le 2025-01-15 17:37:53 UTC
Thanks Ben. Indeed I got the same reference from `scikit-build-core`. The upstream issue is interesting because it contradicts the report by Joao, i.e. `jaraco.text` should also be failing, but maybe it's a difference in versions. And to verify, is this issue related to a package being built or a user experience?

Since we cannot update `setuptools` anyway and if the `pkg_resources` there does indeed work with the `jaraco.text` symlink, I would say that we should create those symlinks for the jaraco packages that we have patched. But we should double-check first that this would not affect `importlib.metadata` path.

Comment 5 Cristian Le 2025-01-15 18:02:28 UTC
Oh, at least for python-cherrypy they have fixed the issue in 18.10.0, and at least adding that fix should be easy. But open to either approach, whichever would be more reliable. Ah, and I get it why this was not picked up by the impact check earlier on since this would not actually fail the build, just return a bogus `__version__`.

Comment 6 Ben Beasley 2025-01-15 18:04:33 UTC
(In reply to Cristian Le from comment #4)
> Thanks Ben. Indeed I got the same reference from `scikit-build-core`. The
> upstream issue is interesting because it contradicts the report by Joao,
> i.e. `jaraco.text` should also be failing, but maybe it's a difference in
> versions. And to verify, is this issue related to a package being built or a
> user experience?

The problem appears to be that pkg_resources can’t handle the normalization. I just installed python3-jaraco-text and python3-setuptools in an EPEL9 chroot and saw the same thing, as you would expect:

Python 3.9.21 (main, Dec  5 2024, 00:00:00) 
[GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.require('jaraco.text')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'jaraco.text' distribution was not found and is required by the application

> Since we cannot update `setuptools` anyway and if the `pkg_resources` there
> does indeed work with the `jaraco.text` symlink, I would say that we should
> create those symlinks for the jaraco packages that we have patched. But we
> should double-check first that this would not affect `importlib.metadata`
> path.

It seems like even the latest (deprecated, then removed) pkg_resources doesn’t handle this properly, so updating setuptools wouldn’t help even if it were possible.

Is it possible to update cherrypy in EPEL9 to 18.10.0, which replaces pkg_resources with importlib.metadata (https://github.com/cherrypy/cherrypy/issues/2019, https://github.com/cherrypy/cherrypy/issues/1973)? Or if there are too many dependency issues or breaking changes to consider that? If so, perhaps just https://github.com/cherrypy/cherrypy/pull/1993 can be backported?

(On preview, I see that you arrived at a similar approach in https://bugzilla.redhat.com/show_bug.cgi?id=2324959#c5.)

Comment 7 Joao Eduardo Luis 2025-01-15 18:11:00 UTC
(In reply to Cristian Le from comment #4)
> Thanks Ben. Indeed I got the same reference from `scikit-build-core`. The
> upstream issue is interesting because it contradicts the report by Joao,
> i.e. `jaraco.text` should also be failing, but maybe it's a difference in
> versions. And to verify, is this issue related to a package being built or a
> user experience?

I believe this would fall under a "user experience" kind of thing.

As Ben has shown in his last comment, the problem arises when importing the package through 'pkg_resources'.

I haven't checked lately whether newer versions of cherrypy have dealt with the issue that I was seeing though, so I can't provide further info on that.

I do wonder if relying on a newer version of cherrypy is the best outcome here though. Keep in mind I don't have package maintenance experience, but I would assume that, until `pkg_resources` is dropped, even if deprecated, support for it would still exist? Either way, I defer to your expertise on that.

Comment 8 Fedora Update System 2025-01-18 20:19:14 UTC
FEDORA-EPEL-2025-3c74eed70b (python-jaraco-text-4.0.0-3.el10_0) has been submitted as an update to Fedora EPEL 10.0.
https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2025-3c74eed70b

Comment 9 Fedora Update System 2025-01-19 01:59:35 UTC
FEDORA-EPEL-2025-3c74eed70b has been pushed to the Fedora EPEL 10.0 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2025-3c74eed70b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Konstantin Shalygin 2025-03-14 10:16:16 UTC
The #2324187 fixes only for el10. The el9 also affected by this issue

Also, issue for el9 can be resolved, via build python-cherrypy 18.10.0


```
[root@c9s]# python
Python 3.9.21 (main, Dec  4 2024, 00:00:00)
[GCC 11.5.0 20240719 (Red Hat 11.5.0-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cherrypy
>>> cherrypy.__version__
'18.10.0'
>>>
```

Comment 11 Fedora Admin user for bugzilla script actions 2025-08-15 13:46:47 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 12 Fedora Admin user for bugzilla script actions 2025-08-25 01:10:36 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.


Note You need to log in before you can comment on or make changes to this bug.