1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 gpytorch,
7 linear-operator,
8 multipledispatch,
9 pyre-extensions,
10 pyro-ppl,
11 setuptools,
12 setuptools-scm,
13 torch,
14 scipy,
15 pytestCheckHook,
16 pythonAtLeast,
17}:
18
19buildPythonPackage rec {
20 pname = "botorch";
21 version = "0.15.1";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "pytorch";
26 repo = "botorch";
27 tag = "v${version}";
28 hash = "sha256-6hAsKIlwycZtLZn1vkcu4fR85uACA4FSkT5e/wos17A=";
29 };
30
31 build-system = [
32 setuptools
33 setuptools-scm
34 ];
35
36 dependencies = [
37 gpytorch
38 linear-operator
39 multipledispatch
40 pyre-extensions
41 pyro-ppl
42 scipy
43 torch
44 ];
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 ];
49
50 disabledTests = [
51 "test_all_cases_covered"
52
53 # Skip tests that take too much time
54 "TestQMultiObjectivePredictiveEntropySearch"
55 "TestQPredictiveEntropySearch"
56 ]
57 ++ lib.optionals (pythonAtLeast "3.13") [
58 # RuntimeError: Boolean value of Tensor with more than one value is ambiguous
59 "test_optimize_acqf_mixed_binary_only"
60 ]
61 ++ lib.optionals (stdenv.buildPlatform.system == "x86_64-linux") [
62 # stuck tests on hydra
63 "test_moo_predictive_entropy_search"
64 ]
65 ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
66 # RuntimeError: required keyword attribute 'value' has the wrong type
67 "test_posterior_in_trace_mode"
68 ]
69 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
70 # Numerical error slightly above threshold
71 # AssertionError: Tensor-likes are not close!
72 "test_model_list_gpytorch_model"
73 ];
74
75 pythonImportsCheck = [ "botorch" ];
76
77 # needs lots of undisturbed CPU time or prone to getting stuck
78 requiredSystemFeatures = [ "big-parallel" ];
79
80 meta = {
81 changelog = "https://github.com/pytorch/botorch/blob/${src.tag}/CHANGELOG.md";
82 description = "Bayesian Optimization in PyTorch";
83 homepage = "https://botorch.org";
84 license = lib.licenses.mit;
85 maintainers = with lib.maintainers; [ veprbl ];
86 };
87}