diff --git a/pkgs/development/python-modules/torch/source/default.nix b/pkgs/development/python-modules/torch/source/default.nix index 19a85037b016..b4301d294982 100644 --- a/pkgs/development/python-modules/torch/source/default.nix +++ b/pkgs/development/python-modules/torch/source/default.nix @@ -25,6 +25,7 @@ # Use the system NCCL as long as we're targeting CUDA on a supported platform. useSystemNccl ? (cudaSupport && cudaPackages.nccl.meta.available || rocmSupport), withNvshmem ? (cudaSupport && cudaPackages.libnvshmem.meta.available), + withTensorboard ? false, MPISupport ? false, mpi, buildDocs ? false, @@ -33,34 +34,41 @@ # tests.cudaAvailable: callPackage, - # Native build inputs + # build-system cmake, + ninja, + numpy, + packaging, + pyyaml, + requests, + six, + + # nativeBuildInputs symlinkJoin, which, pybind11, pkg-config, removeReferencesTo, - # Build inputs + # buildInputs openssl, numactl, llvmPackages, # dependencies - binutils, - expecttest, filelock, fsspec, - hypothesis, jinja2, networkx, - packaging, - psutil, - pyyaml, - requests, + setuptools, sympy, - types-dataclasses, typing-extensions, + + binutils, + expecttest, + hypothesis, + psutil, + types-dataclasses, # ROCm build and `torch.compile` requires `triton` tritonSupport ? (!stdenv.hostPlatform.isDarwin), triton, @@ -84,12 +92,8 @@ # See https://github.com/NixOS/nixpkgs/pull/83888 blas, - # ninja (https://ninja-build.org) must be available to run C++ extensions tests, - ninja, - # dependencies for torch.utils.tensorboard pillow, - six, tensorboard, protobuf, @@ -531,10 +535,20 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { done ''; - nativeBuildInputs = [ + build-system = [ cmake - which ninja + numpy + packaging + pyyaml + requests + setuptools + six + typing-extensions + ]; + + nativeBuildInputs = [ + which pybind11 pkg-config removeReferencesTo @@ -597,33 +611,24 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { rocmPackages.clr # Added separately so setup hook applies ]; - pythonRelaxDeps = [ - "sympy" - ]; dependencies = [ - expecttest filelock fsspec - hypothesis jinja2 networkx - packaging - psutil - pyyaml - requests + setuptools sympy - types-dataclasses typing-extensions - # the following are required for tensorboard support - pillow - six - tensorboard - protobuf - # torch/csrc requires `pybind11` at runtime pybind11 ] + ++ lib.optionals withTensorboard [ + pillow + protobuf + six + tensorboard + ] ++ lib.optionals tritonSupport [ _tritonEffective ] ++ lib.optionals vulkanSupport [ vulkan-headers