NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.07k stars 14.13k forks source link

betterproto fails to import, missing dependency #229660

Closed JordiSalaJuarez closed 11 months ago

JordiSalaJuarez commented 1 year ago

Python package betterproto is missing setuptools as a run time dependency

Steps To Reproduce the bug

[user@system:~]$ nix-shell --expr "((import <nixpkgs> {}).python3.withPackages (ps: with ps; [ betterproto ])).env"
[user@system:~]$ python -c "import betterproto"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/nix/store/09gzdmi5qriws5bv6g14l5ifikqvhjgs-python3-3.10.7-env/lib/python3.10/site-packages/betterproto/__init__.py", line 39, in <module>
    from ._version import __version__
  File "/nix/store/09gzdmi5qriws5bv6g14l5ifikqvhjgs-python3-3.10.7-env/lib/python3.10/site-packages/betterproto/_version.py", line 1, in <module>
    from pkg_resources import get_distribution
ModuleNotFoundError: No module named 'pkg_resources'

Notify maintainers

@nikstur

Fix

This is my overlay.nix fixing the issue

final: prev: {
  pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [(
    python-final: python-prev: {
      betterproto = python-prev.betterproto.overridePythonAttrs (old: {
          propagatedBuildInputs = old.propagatedBuildInputs or [] ++ [ python-prev.setuptools ];
      });
    }
  )];
}

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.3.0, NixOS, 23.05 (Stoat), 23.05.20230502.1a411f2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(root): `"nixos"`
 - channels(jsj): `"nixpkgs"`
 - nixpkgs: `/home/jsj/.nix-defexpr/channels/nixpkgs`

Give me some feedback if this is not properly reported, I'm a newbie when it comes to reporting issues

SuperSandro2000 commented 11 months ago

see #271567