anchor.diff:      sha256 = "1n19yha1cqyx7hnlici1wkl7n68dh0vbpsyydfhign2c0w9jvg42";
     };
   
  +  patches = [
  +    (fetchpatch {
  +      name = "fix-freeimage-tests.patch";
  +      url = "https://github.com/luispedro/mahotas/commit/08cc4aa0cbd5dbd4c37580d52b822810c03b2c69.patch";
  +      sha256 = "0389sz7fyl8h42phw8sn4pxl4wc3brcrj9d05yga21gzil9bfi23";
  +      excludes = [ "ChangeLog" ];
  +    })
  +  ];
  +
     propagatedBuildInputs = [ numpy imread pillow scipy freeimage ];
     checkInputs = [ pytestCheckHook ];
   
     postPatch = ''
  -    substituteInPlace mahotas/io/freeimage.py --replace "/opt/local/lib" "${freeimage}/lib"
  +    substituteInPlace mahotas/io/freeimage.py \
  +      --replace "ctypes.util.find_library('freeimage')" 'True' \
  +      --replace 'ctypes.CDLL(libname)' 'np.ctypeslib.load_library("libfreeimage", "${freeimage}/lib")'
     '';
   
     # tests must be run in the build directory
  
positive.code:     "test_haralick3d"
    ];
  
    disabled = stdenv.isi686; # Failing tests
  
    meta = with lib; {
  
negative.code: { buildPythonPackage
  , fetchFromGitHub
  , fetchpatch
  , pillow
  , scipy
  , numpy
  , pytestCheckHook
  , imread
  , freeimage
  , lib
  , stdenv
  }:
  
  buildPythonPackage rec {
    pname = "mahotas";
  