1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# build-system
setuptools,
setuptools-scm,
# dependencies
gpytorch,
linear-operator,
multipledispatch,
ninja,
pyre-extensions,
scipy,
threadpoolctl,
torch,
typing-extensions,
# optional-dependencies
pymoo,
# tests
jax,
numpyro,
pytestCheckHook,
pythonAtLeast,
}:
buildPythonPackage (finalAttrs: {
pname = "botorch";
version = "0.18.1";
pyproject = true;
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "meta-pytorch";
repo = "botorch";
tag = "v${finalAttrs.version}";
hash = "sha256-tUTtImqPlbS8g1oLoTTCCWQbeLwLop13qPjFrQeMtb8=";
};
patches = [
# Allow scipy 1.18 in batched L-BFGS-B fast path
# https://github.com/meta-pytorch/botorch/pull/3328
(fetchpatch {
name = "scipy-1.18.patch";
url = "https://github.com/meta-pytorch/botorch/commit/611f14acc8c1b2f30ce2ae058568d90f96bbb2ec.patch";
hash = "sha256-PiXq9GmPaWQXh+emY7aNI53Y+ufl8K5uOFa8GD0clP8=";
})
];
build-system = [
setuptools
setuptools-scm
];
dependencies = [
gpytorch
linear-operator
multipledispatch
ninja
pyre-extensions
scipy
threadpoolctl
torch
typing-extensions
];
optional-dependencies = {
pymoo = [
pymoo
];
};
nativeCheckInputs = [
jax
numpyro
pytestCheckHook
];
disabledTestPaths = [
# Requires unpackaged pfns
"test_community/models/test_prior_fitted_network.py"
];
disabledTests = [
"test_all_cases_covered"
# Skip tests that take too much time
"TestQMultiObjectivePredictiveEntropySearch"
"TestQPredictiveEntropySearch"
]
++ lib.optionals (pythonAtLeast "3.13") [
# RuntimeError: Boolean value of Tensor with more than one value is ambiguous
"test_optimize_acqf_mixed_binary_only"
]
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64) [
# stuck tests on hydra
"test_moo_predictive_entropy_search"
]
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
# RuntimeError: Failed to initialize cpuinfo!
"test_append_features"
"test_delattr_ctx"
"test_input_perturbation"
"test_module_rollback_ctx"
"test_parameter_rollback_ctx"
"test_zero_grad_ctx"
]
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
# RuntimeError: required keyword attribute 'value' has the wrong type
"test_posterior_in_trace_mode"
]
++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
# Numerical error slightly above threshold
# AssertionError: Tensor-likes are not close!
"test_model_list_gpytorch_model"
];
pythonImportsCheck = [ "botorch" ];
# needs lots of undisturbed CPU time or prone to getting stuck
requiredSystemFeatures = [ "big-parallel" ];
meta = {
changelog = "https://github.com/meta-pytorch/botorch/blob/${finalAttrs.src.tag}/CHANGELOG.md";
description = "Bayesian Optimization in PyTorch";
homepage = "https://botorch.org";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ veprbl ];
};
})
|