From bda7bbcd0da5d43f8b6b1d622aaed739941e7a9e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Wed, 10 Jun 2026 15:57:42 +0000 Subject: [PATCH] python3Packages.torchmd-net: init at 3.0.3 --- .../python-modules/torchmd-net/default.nix | 96 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 98 insertions(+) create mode 100644 pkgs/development/python-modules/torchmd-net/default.nix diff --git a/pkgs/development/python-modules/torchmd-net/default.nix b/pkgs/development/python-modules/torchmd-net/default.nix new file mode 100644 index 000000000000..5651c4428ef9 --- /dev/null +++ b/pkgs/development/python-modules/torchmd-net/default.nix @@ -0,0 +1,96 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + setuptools-scm, + + # dependencies + ase, + h5py, + lightning, + numpy, + torch, + torch-geometric, + tqdm, + warp-lang, + + # tests + pytest-xdist, + pytestCheckHook, + writableTmpDirAsHomeHook, + llvmPackages, +}: + +buildPythonPackage (finalAttrs: { + pname = "torchmd-net"; + version = "3.0.3"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "torchmd"; + repo = "torchmd-net"; + tag = "v${finalAttrs.version}"; + hash = "sha256-FBeeNkc7mJQYmMwlsW3Un+3RHvErJM7rWKUqSCYYUCM="; + }; + + build-system = [ + setuptools + setuptools-scm + ]; + + pythonRemoveDeps = [ + # Not a runtime dependency + "setuptools" + ]; + dependencies = [ + ase + h5py + lightning + numpy + torch + torch-geometric + tqdm + warp-lang + ]; + + pythonImportsCheck = [ "torchmdnet" ]; + + nativeCheckInputs = [ + pytest-xdist + pytestCheckHook + writableTmpDirAsHomeHook + ]; + + checkInputs = lib.optionals stdenv.cc.isClang [ + # torch._inductor.exc.InductorError: CppCompileError: C++ compile error + # fatal error: 'omp.h' file not found + llvmPackages.openmp + ]; + + disabledTests = [ + # Require internet access + "test_dataset_s66x8" + + # Failed: torch.compile failed on TorchScripted tensornet model: + # torch.compile does not support compiling torch.jit.script or torch.jit.freeze models directly. + "test_torchscript_then_compile" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # torch._inductor.exc.InductorError: ImportError: ... + # symbol not found in flat namespace '___kmpc_barrier' + "test_ase_calculator" + "test_torch_export_then_compile" + ]; + + meta = { + description = "Library to train state-of-the-art neural networks potentials (NNPs)"; + homepage = "https://github.com/torchmd/torchmd-net"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7df2b7d1b18d..b10d95327e0e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -19946,6 +19946,8 @@ self: super: with self; { torchlibrosa = callPackage ../development/python-modules/torchlibrosa { }; + torchmd-net = callPackage ../development/python-modules/torchmd-net { }; + torchmetrics = callPackage ../development/python-modules/torchmetrics { }; torchprofile = callPackage ../development/python-modules/torchprofile { };