pkg_resources.require() doesn't find soundconverter in flatpak

Bug #1956623 reported by Johannes Maibaum
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SoundConverter
New
Undecided
Unassigned

Bug Description

See downstream issue: https://github.com/flathub/org.soundconverter.SoundConverter/issues/6

A flatpak user noticed that the flatpak on flathub `org.soundconverter.SoundConverter` doesn't launch anymore, but instead `pkg_resources` raises `DistributionNotFound`:

```
[jm@jxps13 ~]$ flatpak run org.soundconverter.SoundConverter
Traceback (most recent call last):
  File "/app/bin/soundconverter", line 36, in <module>
    VERSION = pkg_resources.require('soundconverter')[0].version
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'soundconverter' distribution was not found and is required by the application
```

I have looked around, but so far have no idea what change in setuptools (presumably) caused this not working anymore. `soundconverter` is properly installed into `/app/lib/python3.9/site-packages`, and `/app/lib/python3.9/site-packages` is in `sys.path`:

```
[jm@jxps13 ~]$ flatpak run --command=python org.soundconverter.SoundConverter -c 'import sys;print(sys.path)'
['', '/usr/lib/python39.zip', '/usr/lib/python3.9', '/usr/lib/python3.9/lib-dynload', '/usr/lib/python3.9/site-packages', '/app/lib/python3.9/site-packages']
```

Yet, as you can see from my comment on the Github issue, explicitly setting `PYTHONPATH` to `/app/lib/python3.9/site-packages` makes soundconverter launch normally.

I am out of ideas, so I thought I might ask here. Any idea?

Revision history for this message
sezanzeb (sezanzeb) wrote :

since pkg_resources is not important for soundconverter to work, I'll try/catch it.

This is actually not the first time I have seen this failing, whatever the reason is

Revision history for this message
sezanzeb (sezanzeb) wrote :

oh shit here this is used to figure out where data files are. I'll need to look a bit into it

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.