python3Packages.torch: cleanup dependencies (#536976)

This commit is contained in:
Gaétan Lepage
2026-07-08 15:12:10 +00:00
committed by GitHub
2 changed files with 37 additions and 45 deletions
@@ -165,19 +165,6 @@ buildPythonPackage (finalAttrs: {
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Build hangs after all the tests are run due to a torch subprocess not exiting
"test_multiprocess_loading"
# torch._inductor.exc.InductorError: CppCompileError: C++ compile error
# OpenMP support not found
# TODO: figure out why this only happens on python 3.13 and not 3.14
"test_cosine_distance"
"test_ground_truth"
"test_index_cast_centroids"
"test_index_with_no_centroid_movement"
"test_l2_distance"
"test_l2_distance_f16_bf16_cpu"
"test_pairwise_cosine"
"test_torch_index_with_nans"
"test_torch_kmeans_nans"
]
++ lib.optionals (pythonAtLeast "3.14") [
# RuntimeError: torch.compile is not supported on Python 3.14+
@@ -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,
@@ -533,10 +537,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
@@ -599,33 +613,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