Commit d001cf04 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files
parent 177911f8
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -26,16 +26,16 @@ let
  inherit (torch) cudaCapabilities cudaPackages cudaSupport;

in
buildPythonPackage.override { stdenv = torch.stdenv; } (finalAttrs: {
buildPythonPackage.override { inherit (torch) stdenv; } (finalAttrs: {
  pname = "torchvision";
  version = "0.25.0";
  version = "0.26.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pytorch";
    repo = "vision";
    tag = "v${finalAttrs.version}";
    hash = "sha256-oktJHcT6T4f58pUO+HSBpbyS1ISH3zDlTsXQh6PcMy4=";
    hash = "sha256-FOdDGY3v8yWBhtNo9tZP79/xwrc7AoIY5Y1ZABzWe6g=";
  };

  nativeBuildInputs = [
@@ -63,6 +63,18 @@ buildPythonPackage.override { stdenv = torch.stdenv; } (finalAttrs: {
    TORCHVISION_LIBRARY = "${libjpeg_turbo}/lib/";
  }
  // lib.optionalAttrs cudaSupport {
    # At of 2026-03-27, the default `cudaPackages` version is 12.9.1
    # According to Nvidia, it should support GCC versions up to 14.x:
    # -> https://docs.nvidia.com/cuda/archive/12.9.1/cuda-installation-guide-linux/index.html#host-compiler-support-policy
    # However, PyTorch's *strict* upper bound is 14.0:
    # -> https://github.com/pytorch/pytorch/blob/v2.11.0/torch/utils/cpp_extension.py#L75
    # Hence, the build fails with:
    #   RuntimeError: The current installed version of g++ (14.3.0) is greater than the maximum
    #   required version by CUDA 12.9. Please make sure to use an adequate version of g++
    #   (>=6.0.0, <14.0).
    # Hence, we disable the version check to silence the error:
    TORCH_DONT_CHECK_COMPILER_ABI = 1;

    TORCH_CUDA_ARCH_LIST = "${lib.concatStringsSep ";" cudaCapabilities}";
    FORCE_CUDA = 1;
  };