2021-08-22 07:53:02 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPythonPackage
|
|
|
|
, numpy
|
|
|
|
, scipy
|
2022-09-09 14:08:57 +00:00
|
|
|
, torch
|
2021-08-22 07:53:02 +00:00
|
|
|
, autograd
|
|
|
|
, nose2
|
2022-08-21 13:32:41 +00:00
|
|
|
, matplotlib
|
|
|
|
, tensorflow
|
2021-08-22 07:53:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pymanopt";
|
2023-03-15 16:39:30 +00:00
|
|
|
version = "2.1.1";
|
2021-08-22 07:53:02 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-nbSxqMmYWi71s74bbB9LAlPKEslTqG/j266cLfNHrwg=";
|
2021-08-22 07:53:02 +00:00
|
|
|
};
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
propagatedBuildInputs = [ numpy scipy torch ];
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ nose2 autograd matplotlib tensorflow ];
|
2021-08-22 07:53:02 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
2022-08-21 13:32:41 +00:00
|
|
|
runHook preCheck
|
2022-12-02 08:20:57 +00:00
|
|
|
|
|
|
|
# upstream themselves seem unsure about the robustness of these
|
|
|
|
# tests - see https://github.com/pymanopt/pymanopt/issues/219
|
|
|
|
grep -lr 'test_second_order_function_approximation' tests/ | while read -r fn ; do
|
|
|
|
substituteInPlace "$fn" \
|
|
|
|
--replace \
|
|
|
|
'test_second_order_function_approximation' \
|
|
|
|
'dont_test_second_order_function_approximation'
|
|
|
|
done
|
2021-08-22 07:53:02 +00:00
|
|
|
|
|
|
|
nose2 tests -v
|
2022-12-02 08:20:57 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
runHook postCheck
|
2021-08-22 07:53:02 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "pymanopt" ];
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Python toolbox for optimization on Riemannian manifolds with support for automatic differentiation";
|
|
|
|
homepage = "https://www.pymanopt.org/";
|
|
|
|
license = lib.licenses.bsd3;
|
|
|
|
maintainers = with lib.maintainers; [ yl3dy ];
|
|
|
|
};
|
|
|
|
}
|