Assistance needed in packaging python program

I have exactly the same problem right now, the same issue with a python package I want to build.

I am trying to adapt the following stagnant PR from nixpkgs to my local setup: nerd-dictation: init at unstable-2022-07-12 by jtojnar · Pull Request #185148 · NixOS/nixpkgs · GitHub

It includes a python package for interacting with the vosk-api.

My attempt to package the python vosk API looks like this. This is basically just a copy-paste from the PR.

{ buildPythonPackage
, fetchPypi
, cffi
, srt
, tqdm
, requests
, websockets
, substituteAll
, vosk-api
, lib
}:

buildPythonPackage rec {
  pname = "vosk";
  version = "0.3.45";
  # inherit (vosk-api) src version;
  src = fetchPypi {
    inherit pname version;
    sha256 = "";
  };

  patches = [
    (substituteAll {
      src = ./fix-paths.patch;
      vosk_api = vosk-api;
    })
  ];

  propagatedBuildInputs = [
    cffi
    srt
    tqdm
    requests
    websockets
  ];

  # No tests.
  doCheck = false;

  pythonImportsCheck = [
    "vosk"
  ];

  postPatch = ''
    cd python
  '';

  meta = with lib; {
    description = "Python bindings for VOSK API";
    homepage = "https://github.com/alphacep/vosk-api";
    license = licenses.asl20;
    maintainers = with maintainers; [ ];
    platforms = platforms.linux;
  };
}

However I run into the same problem when trying to use this,

I find the solution to be non-obvious to say the least. Why does nix complain here that buildPythonPackage is not provided?

What was the solution you went for, @thiloho ?