1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6
7 # build-system
8 setuptools-scm,
9
10 # dependencies
11 numpy,
12 scipy,
13
14 # tests
15 autograd,
16 jax,
17 matplotlib,
18 pytestCheckHook,
19 tensorflow,
20 torch,
21}:
22
23buildPythonPackage rec {
24 pname = "pymanopt";
25 version = "2.2.1";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "pymanopt";
30 repo = "pymanopt";
31 tag = version;
32 hash = "sha256-LOEulticgCWZBCf3qj5KFBHt0lMd4H85368IhG3DQ4g=";
33 };
34
35 preConfigure = ''
36 substituteInPlace pyproject.toml \
37 --replace-fail '"pip==22.3.1",' ""
38 '';
39
40 build-system = [
41 setuptools-scm
42 ];
43
44 dependencies = [
45 numpy
46 scipy
47 ];
48
49 pythonImportsCheck = [ "pymanopt" ];
50
51 nativeCheckInputs = [
52 autograd
53 jax
54 matplotlib
55 pytestCheckHook
56 tensorflow
57 torch
58 ];
59
60 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
61 # FloatingPointError: divide by zero encountered in det
62 "tests/manifolds/test_positive_definite.py::TestMultiSpecialHermitianPositiveDefiniteManifold::test_retraction"
63 "tests/manifolds/test_positive_definite.py::TestSingleSpecialHermitianPositiveDefiniteManifold::test_retraction"
64 ];
65
66 meta = {
67 description = "Python toolbox for optimization on Riemannian manifolds with support for automatic differentiation";
68 homepage = "https://www.pymanopt.org/";
69 changelog = "https://github.com/pymanopt/pymanopt/releases/tag/${version}";
70 license = lib.licenses.bsd3;
71 maintainers = with lib.maintainers; [ yl3dy ];
72 };
73}