py2app icon indicating copy to clipboard operation
py2app copied to clipboard

app fails to launch with `ModuleNotFoundError: No module named 'jaraco.text'`

Open glyph opened this issue 1 year ago • 6 comments

This appears to be similar to #412 .

An affected build can be found here: https://github.com/glyph/Pomodouroboros/releases/tag/0.4.6

glyph avatar Sep 04 '24 00:09 glyph

Looks like it's another setuptools incompatibility and it can be addressed by downgrading to 70.3.0. I was trying to be clever after mitigating https://github.com/ronaldoussoren/py2app/issues/531 by upgrading as far as possible without getting to the "bad" version of 71+ but I should have stuck with the version suggested by others on that issue :)

glyph avatar Sep 04 '24 00:09 glyph

Using py2app 0.28.8 and setuptools 70.3.0 I still get the error No module named 'jaraco.text'. Am I missing a workaround?

ajkessel avatar Oct 21 '24 21:10 ajkessel

Hmm. Reviewing my build configuration, I don't see any other workarounds. Are you sure you've got that version of setuptools installed? Given the core nature of the dependency (i.e., pip needs it) you may need to separately, manually install it.

glyph avatar Oct 21 '24 23:10 glyph

Hmm. Reviewing my build configuration, I don't see any other workarounds. Are you sure you've got that version of setuptools installed? Given the core nature of the dependency (i.e., pip needs it) you may need to separately, manually install it.

Oh, you're right. Somehow setuptools got upgraded after I downgraded it. I pushed it back again and I am now able to build with 70.3.0.

ajkessel avatar Oct 22 '24 01:10 ajkessel

I found a workaround, if anyone has this problem and (like I am) is too lazy to upgrade.

First, in setup.py set { 'py2app': {'argv_emulation': False} } or inside OPTIONS, (idk your setup)

Finally, in file dist/<Your-App>/Contents/Resources/lib/python3.12/pkg_resources/__init__.py

  1. Delete line from jaraco.text import drop_comment, join_continuation, yield_lines
  2. Paste reimplementation of yield_lines after the imports and before warnings.warn(
def yield_lines(strs):
    for s in strs:
        if hasattr(s, 'splitlines'):
            for line in s.splitlines():
                yield line
        else:
            yield s

drop_comment and join_continuation were not needed anywhere, I guess because of the disabled argv_emulation.

indierodo avatar Jul 14 '25 19:07 indierodo

I just installed jaraco.text and added includes':['jaraco.text'] to my options, and it started working again.

radarhere avatar Aug 16 '25 06:08 radarhere