Package python library: ERROR: Could not find a version that satisfies the requirement chompack

Hello,

I’m trying to package the python library smcp. However, I’m stick with an error concerning chompack:

Processing ./smcp-0.4.6-cp37-cp37m-linux_x86_64.whl
Collecting chompack>=2.3.2 (from smcp==0.4.6)
  ERROR: Could not find a version that satisfies the requirement chompack

However, I tried to add chompack v2.3.3 (I built it from the same .nix) in propagatedBuildInputs, so I’m not sure to understand why it tries to install another chompack… Any idea?

Thanks!

File that I build with nix-build -E "with import <nixpkgs> {}; python3Packages.callPackage ./smcp.nix {}":

# nix-build -E "with import <nixpkgs> {}; python3Packages.callPackage ./default.nix {}"
{ lib
, buildPythonPackage
, fetchFromGitHub
, numpy
}:

let
  chompack =
    buildPythonPackage rec {
      pname = "chompack";
      version = "v2.3.3";

      src = fetchFromGitHub {
        owner = "cvxopt";
        repo = "chompack";
        rev = "v${version}";
        sha256 = "0nlwgkaihbc6mr4jyayvdr23bzm79ih049x7v3bv9agdjr7dn1kz"; # lib.fakeSha256
      };

      propagatedBuildInputs = [
        numpy
      ];

      # fails to create a daemon, probably because of sandboxing
      doCheck = false;

      meta = with lib; {
        description = "Library for chordal matrix computations";
        homepage = https://github.com/cvxopt/chompack;
        license = licenses.gpl3;
        maintainers = with maintainers; [ tobiasBora ];
      };
    }
;
in
buildPythonPackage rec {
  pname = "smcp";
  version = "0.4.6";

  src = fetchFromGitHub {
    owner = "cvxopt";
    repo = "smcp";
    rev = "v${version}";
    sha256 = "0nlwgkaihbc6mr4jyayvdr23bzm79ih049x7v3bv9agdjr7dn1kz"; # lib.fakeSha256
  };

  propagatedBuildInputs = [
    numpy
    chompack
  ];

  # fails to create a daemon, probably because of sandboxing
  doCheck = false;

  meta = with lib; {
    description = "A solver for sparse matrix cone programs";
    homepage = https://github.com/cvxopt/smcp;
    license = licenses.gpl3;
    maintainers = with maintainers; [ tobiasBora ];
  };
}

Here’s what you need to do

@@ -2,23 +2,32 @@
 , buildPythonPackage
 , fetchFromGitHub
 , numpy
+, liblapack
+, blas
+, cvxopt
 }:
 
 let
   chompack =
     buildPythonPackage rec {
       pname = "chompack";
-      version = "v2.3.3";
+      version = "2.3.3";
 
       src = fetchFromGitHub {
         owner = "cvxopt";
         repo = "chompack";
         rev = "v${version}";
-        sha256 = "0nlwgkaihbc6mr4jyayvdr23bzm79ih049x7v3bv9agdjr7dn1kz"; # lib.fakeSha256
+        sha256 = "0kd37kqg95sf3mgg9ma9haayz73d5y2y4d0sa1xrf71x0jvmbnad";
       };
 
+      buildInputs = [
+        blas
+        liblapack
+      ];
+
       propagatedBuildInputs = [
         numpy
+        cvxopt
       ];
 
       # fails to create a daemon, probably because of sandboxing

You were using the same hash in both src attributes. Because they are fixed output derivations, nix doesn’t evaluate it again, to check that it evaluates to the same hash. It’s only ever built once. (Well okay, I think there’s a timeout when it expires)

2 Likes