Skip to content

python3 opencv4 package breakage #2

@Pleune

Description

@Pleune

This overlay is breaking python3 opencv4 for me, I believe because your opencv4 package definition has removed pythonPackages arg set here https://github.com/NixOS/nixpkgs/blob/e7ca551dd57e3c87284b4c264f445cd0df4146dd/pkgs/top-level/python-packages.nix#L9778

I think you just need to redefine python3Packages.opencv4 with a pythonPackageExtensions so this nixpkgs definition is not used? and you can change it to python3Packages?

error:
       … while calling the 'head' builtin
         at /nix/store/brjzz8wv5k09bq0yrvhc1j4hd8677k21-source/lib/attrsets.nix:1574:11:
         1573|         || pred here (elemAt values 1) (head values) then
         1574|           head values
             |           ^
         1575|         else

       … while evaluating the attribute 'value'
         at /nix/store/brjzz8wv5k09bq0yrvhc1j4hd8677k21-source/lib/modules.nix:853:9:
          852|     in warnDeprecation opt //
          853|       { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          854|         inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/brjzz8wv5k09bq0yrvhc1j4hd8677k21-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/store/brjzz8wv5k09bq0yrvhc1j4hd8677k21-source/nixos/modules/system/boot/systemd.nix':

       … while evaluating the option `systemd.services.open-webui.serviceConfig':

       … while evaluating definitions from `/nix/store/brjzz8wv5k09bq0yrvhc1j4hd8677k21-source/nixos/modules/services/misc/open-webui.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: function 'anonymous lambda' called with unexpected argument 'pythonPackages'
       at /nix/store/0psxpc123l1v1d5gzb97ibqszqf6ccw4-source/packages/opencv4/package.nix:1:1:
            1| {
             | ^
            2|   blas,
       Did you mean python3Packages?

I fixed it with this overlay after yours.

final: prev: {
  cudaPackages = prev.cudaPackages_12_6;
  pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
    (pyFinal: pyPrev: {
      opencv4 = pyPrev.toPythonModule (prev.opencv4.override { enablePython = true; python3Packages = pyPrev; });
    })
  ];
}

Thanks for the large amount of work you are putting into this refactor ❤ . It seems to me like nixpkgs really needs it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions