ModuleNotFoundError: pkg_resources, adding setuptools does not work

I’m trying to create a package for a python application (s. code below). However, when running it, I’m getting a ModuleNotFoundError: No module named ‘pkg_resources’. Adding ‘setuptools’ to the propagatedBuildInputs as suggested here link didn’t help. Any ideas?

{ lib, buildPythonPackage, fetchFromGitHub, pytestCheckHook, python3Packages }:
 
buildPythonPackage rec {
  pname = "python-eduvpn-client";
  version = "3.1.0";
 
  src = fetchFromGitHub {
    owner = "eduvpn";
    repo = pname;
    rev = version;
    sha256 = "sha256-dCVCXCPw0PCE0d6KPmuhv/V4WVQS+ucQbWoR0Lx5TDk=";
  };
 
  buildInputs = with python3Packages; [ pytest-runner pynacl requests-oauthlib setuptools ];
  propagateBuildInputs = with python3Packages; [ setuptools ];
 
  checkInputs = [ pytestCheckHook ];
 
  meta = with lib; {
    homepage = "https://github.com/eduvpn/python-eduvpn-client";
    description = "Linux client and Python client API for eduVPN";
    license = with licenses; [ gpl3 ];
    maintainers = with maintainers; [ ];
  };
}

So, there was actually a typo… It should be ‘propagatedBuildInputs’ instead of ‘propagateBuildInputs’!

You don’t want to use python3 inside of buildPythonpackage due to possible python mismatches. Either use the callPackage in scope at python-packages.nix or you would want to get buildPythonPackage and all python packages from the same python attr.

Also pytest-runner is usefless inside the nix sandbox and we usually just remove the dependency on it.

1 Like