Python packaging error, needs specific setuptools version

Hello, I’m trying to package a program called lnxlink, but my build is talking about an error where it requires a specific setuptools version set by pyproject.toml.

My current derivation with buildPythonPackage :

{pkgs ? import <nixpkgs> {}}:
with pkgs.python3Packages;
  buildPythonPackage rec {
    pname = "lnxlink";
    version = "2025.10.0";
    format = "pyproject";
    disabled = pythonOlder "3.8";

    src = fetchPypi {
      inherit pname version;
      hash = "sha256-kiHnMw+wZlezW9kT38Iy+L7ray0drRPceDRpbDlYL1g=";
    };

    propagatedBuildInputs = [
      # System Dependencies
      distro
      pyyaml
      paho-mqtt
      requests
      psutil
      inotify
      jeepney
      aiohttp
      setuptools
      wheel

      # Module dependencies
      pygobject3
      speechrecognition
      docker
      ewmh
      flask
      mss
      numpy
      opencv-python
      pulsectl
      pyalsaaudio
      xlib
      vdf
      waitress
    ];
  }

The error that I get is this:

       > ERROR Missing dependencies:
       >      setuptools~=68.0.0
       >      wheel~=0.40.0

Hi, you need to relax the version requirements for setuptools:

postPatch = ''
  substituteInPlace pyproject.toml \
    --replace-fail "setuptools~=68.0.0" "setuptools"
'';

You might also want to replace format = "pyproject" woth pyproject = true; and split your propagatedBuildInputs into build-system/dependencies to follow nixpkgs conventions

2 Likes