Missing setuptools dist_wheel to build a python package

Hi,

I am trying to write a simple flake to package the lorem python package.

Here is my flake, with a simple shell to test it:

{
  description = "python-lorem python package";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.05";
  };

  outputs = { self, nixpkgs }: {

    packages.x86_64-linux.lorem = let
      pkgs = import nixpkgs { system = "x86_64-linux"; };
    in 
    pkgs.python3Packages.buildPythonPackage rec {
      pname = "python-lorem";
      version = "1.3.0.post3";

      src = pkgs.fetchFromGitHub {
        owner = "JarryShaw";
        repo = "lorem";
        rev = "v${version}";
        hash = "sha256-H43DujOJxUefYEHC5QuTtNksph67TGV76OIa/2xkq08=";
      };
      
      build-system = [ 
        pkgs.python3Packages.setuptools
        pkgs.python3Packages.wheel
      ];
    };

	devShells.x86_64-linux.default = let
      pkgs = import nixpkgs { system = "x86_64-linux"; };
    in
    pkgs.mkShell {
      packages = [
        (pkgs.python3.withPackages (ps: with ps; [
          self.packages.x86_64-linux.lorem
        ]))
      ];
    };

    packages.x86_64-linux.default = self.packages.x86_64-linux.lorem;
  };
}

With github:nixos/nixpkgs?ref=nixos-24.05 as input, the build fails with ModuleNotFoundError: No module named 'setuptools.command.bdist_wheel', while it succeeds with input github:nixos/nixpkgs?ref=nixos-unstable.

Could someone explain why ? I’d be happy to have a solution to use this package with my python3 interpreter on Nixos-24.05.

NB: when making a shell with setuptools, the setuptools.caommand.bdist_wheel module is indeed available with nixpkgs-unstable and not with nixpkgs-24.05. There seem to be ongoing work on setuptools packaging in nixpkgs (see eg: python3Packages.setuptools, thrift: Fix setuptools to give thrift python 3.12 support by kfollesdal · Pull Request #328415 · NixOS/nixpkgs · GitHub) but I do not understand the technical points discussed in this post.

Per

the wheel package is meant to fix this error. If it’s not fixing this error, it appears to be a bug, that’s worth reporting on github. It’s possible that this was fixed in unstable and someone forgot to backport it (though since this is the release month, honestly you should just wait 3 weeks if you want to use stable, or use unstable now.)

what did you mean by “my interpreter” here?

Thanks for looking into this.
The flake above includes wheel in build-system. Should it be specified somewhere else ?

“My interpreter” simply refers to pkgs.python3. I mentioned it because, as an uneducated attempt, I tried building the lorem package with nixpkgs-unstable input and include it in my main configuration which uses nixpkgs-24.05. I could’n import lorem in the default interpreter, but I think it is because the lorem package comes with its own interpreter from nixpkgs-unstable.

I could indeed wait for 3 weeks, but I would prefer to at least understand what would be a proper fix. I want to overcome this recurrent ovewhelming feeling that I will never manage to tame Nix :stuck_out_tongue: