chaudum / rgain3

A Python 3 compatible fork of rgain -- ReplayGain tools and Python library
GNU General Public License v2.0
51 stars 10 forks source link

add setuptools to runtime dependencies #56

Open iconoclasthero opened 6 months ago

iconoclasthero commented 6 months ago
$ apt install python3-pkg-resources ; replaygain
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-pkg-resources is already the newest version (68.1.2-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Traceback (most recent call last):
  File "/home//.local/bin/replaygain", line 3, in <module>
    from rgain3.script.replaygain import replaygain
  File "/home//.local/share/pipx/venvs/rgain3/lib/python3.12/site-packages/rgain3/__init__.py", line 19, in <module>
    from .version import __version__
  File "/home//.local/share/pipx/venvs/rgain3/lib/python3.12/site-packages/rgain3/version.py", line 1, in <module>
    from pkg_resources import DistributionNotFound, get_distribution
ModuleNotFoundError: No module named 'pkg_resources'
$ pipx runpip rgain3 install setuptools; collectiongain
Collecting setuptools
  Using cached setuptools-69.2.0-py3-none-any.whl.metadata (6.3 kB)
Using cached setuptools-69.2.0-py3-none-any.whl (821 kB)
Installing collected packages: setuptools
Successfully installed setuptools-69.2.0
Usage: collectiongain [options] MUSIC_DIR

collectiongain: error: pass one directory path
iconoclasthero commented 6 months ago

0h and ... <string>:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

iconoclasthero commented 6 months ago

So in my discussion on #python last night, it turns out that >= Python 3.12, setuptools is no longer packaged by default in the venv so it needs to be explicitly stated in e.g. requirements in order for it to work in a venv, however the deprecated dependency should probably be replaced instead... In my case, I'm managing it with pipx as suggested by pip when it fails to install system wide on a rolling Ubuntu derivative:*

$ python3 -m pip install --user rgain3
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Anyway, point being, I really don't know enough about what's going on to troubleshoot stuff like this which is why I'm submitting it as an issue and why I had to ask on #python.

Thanks