Merge pull request #290474 from fabaff/imagededup-fix

python311Packages.imagededup: fix build
This commit is contained in:
Felix Bühler 2024-02-22 20:58:47 +01:00 committed by GitHub
commit e3c1c4a9ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,17 +1,19 @@
{ lib
, buildPythonPackage
, cython
, fetchFromGitHub
, fetchurl
, cython
, matplotlib
, pillow
, pytest-mock
, pytestCheckHook
, pythonOlder
, pywavelets
, scikit-learn
, setuptools
, torch
, torchvision
, pillow
, tqdm
, scikit-learn
, pywavelets
, matplotlib
, pytestCheckHook
, pytest-mock
}:
let
MobileNetV3 = fetchurl {
@ -23,50 +25,57 @@ let
hash = "sha256-msG1N42ZJ71sg3TODNVX74Dhs/j7wYWd8zLE3J0P2CU=";
};
EfficientNet = fetchurl {
url = "https://download.pytorch.org/models/efficientnet_b4_rwightman-7eb33cd5.pth";
url = "https://download.pytorch.org/models/efficientnet_b4_rwightman-23ab8bcd.pth";
hash = "sha256-I6uLzVvb72GnpDuRrcrYH2Iv1/NvtJNaVpgo13iIxE4=";
};
in
buildPythonPackage rec {
pname = "imagededup";
version = "0.3.2";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "idealo";
repo = pname;
rev = "v${version}";
repo = "imagededup";
rev = "refs/tags/v${version}";
hash = "sha256-B2IuNMTZnzBi6IxrHBoMDsmIcqGQpznd/2f1XKo1Oa4=";
};
nativeBuildInputs = [
cython
setuptools
];
propagatedBuildInputs = [
matplotlib
pillow
pywavelets
scikit-learn
torch
torchvision
pillow
tqdm
scikit-learn
pywavelets
matplotlib
];
nativeCheckInputs = [ pytestCheckHook pytest-mock ];
nativeCheckInputs = [
pytest-mock
pytestCheckHook
];
preCheck = ''
# checks fail with: error: [Errno 13] Permission denied: '/homeless-shelter'
export HOME=$(mktemp -d)
# checks with CNN are preloaded to avoid downloads in check-phase
# Checks with CNN are preloaded to avoid downloads in the check phase
mkdir -p $HOME/.cache/torch/hub/checkpoints/
ln -s ${MobileNetV3} $HOME/.cache/torch/hub/checkpoints/${MobileNetV3.name}
ln -s ${ViT} $HOME/.cache/torch/hub/checkpoints/${ViT.name}
ln -s ${EfficientNet} $HOME/.cache/torch/hub/checkpoints/${EfficientNet.name}
'';
pythonImportsCheck = [ "imagededup" ];
pythonImportsCheck = [
"imagededup"
];
meta = with lib; {
homepage = "https://idealo.github.io/imagededup/";