diff --git a/pkgs/development/python-modules/paddlepaddle/binary-hashes.nix b/pkgs/development/python-modules/paddlepaddle/binary-hashes.nix index 5c3c66dddd9a..2b205f662d5b 100644 --- a/pkgs/development/python-modules/paddlepaddle/binary-hashes.nix +++ b/pkgs/development/python-modules/paddlepaddle/binary-hashes.nix @@ -2,26 +2,33 @@ x86_64-linux = { platform = "manylinux1_x86_64"; cpu = { - cp39 = "sha256-Yu/FWoMhYp+behAth/jH0FKlf2LJr8TyvL9MBwmuews="; - cp310 = "sha256-O7d/5LY2dEMf5gW5WrN3xzIIEi2vT0RWoMeVOk5lATk="; + cp312 = "sha256-gafFsQFQsHUh0c0Ukdyh+3b/YhsU2xDomdlZ86d5Neo="; + cp313 = "sha256-j8SGXv02Vu6ZQkEkeSy4imQhUbTVkafW1KXGr9rpWVk="; }; gpu = { - cp39 = "sha256-XHREY27jc+BrVyCJgpMvPVOFiKgPwuiNXPXO3biMLnc="; - cp310 = "sha256-oTEBa26o5g6ruuTBgUljjDqign5fXmCn0EnL/0mv+ao="; + cp311 = "sha256-KWlGhjg9k1+wlm3Tk/mvMqh9LWZ0yGA1g99bCPlFf0U="; + cp312 = "sha256-KJ2drJWLuwdaYsCj7egh1nQV4j35vT+UgH0qTdxoyHk="; + }; + }; + aarch64-linux = { + platform = "manylinux2014_aarch64"; + cpu = { + cp312 = "sha256-3aqZaosKANvkJp2iHWUFKHfsNpOiLswHucraPs0RaIY="; + cp313 = "sha256-u8TVc7NdJKJi4C1yaW6A9bSu5B9phnGvlXTe6xqD5vc="; }; }; x86_64-darwin = { platform = "macosx_10_9_x86_64"; cpu = { - cp39 = "sha256-5g9b2gC6uosMpoJiobpj8yToIS6ifAFRvLEqnc/o/QQ="; - cp310 = "sha256-2c1hjwNCOOOx9tVfBk+Pyk/pF0m/2tAmRsBH91834eM="; + cp312 = "sha256-3P6/sQ3rFaoz0qLWbVoS2d5lRh2KQNJofi+zIhFQ0Lo="; + cp313 = "sha256-UsQB/+Sq5WMWZgozAVpv11XNoj09cKKLE7c9cMvbuMs="; }; }; aarch64-darwin = { platform = "macosx_11_0_arm64"; cpu = { - cp39 = "sha256-JhYNTOx1UkuNf/63lHXBDry6FQjPnbIB8jU5jKcyX2k="; - cp310 = "sha256-4ltYEYm2OzPBc6D2bQt2dEh6Sz+5m1mMKGGYgQGLSAY="; + cp312 = "sha256-hnfo1C/2b3T7yjL/Mti2S749Vu0pqS1D3EGPDxaPy2k="; + cp313 = "sha256-nRBR8uII2h1Dna7nyGG8tQJA8JcSSW62Hpzoxhj68vk="; }; }; } diff --git a/pkgs/development/python-modules/paddlepaddle/default.nix b/pkgs/development/python-modules/paddlepaddle/default.nix index 8263ae8ec8c5..02e52be20534 100644 --- a/pkgs/development/python-modules/paddlepaddle/default.nix +++ b/pkgs/development/python-modules/paddlepaddle/default.nix @@ -1,13 +1,12 @@ { - stdenv, config, lib, + stdenv, buildPythonPackage, fetchPypi, python, pythonOlder, pythonAtLeast, - openssl_1_1, zlib, setuptools, cudaSupport ? config.cudaSupport or false, @@ -20,22 +19,22 @@ pillow, decorator, astor, - paddle-bfloat, opt-einsum, + typing-extensions, }: let pname = "paddlepaddle" + lib.optionalString cudaSupport "-gpu"; - version = "2.5.0"; + version = if cudaSupport then "2.6.2" else "3.0.0"; format = "wheel"; pyShortVersion = "cp${builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion}"; cpuOrGpu = if cudaSupport then "gpu" else "cpu"; allHashAndPlatform = import ./binary-hashes.nix; hash = - allHashAndPlatform."${stdenv.system}"."${cpuOrGpu}"."${pyShortVersion}" - or (throw "${pname} has no binary-hashes.nix entry for '${stdenv.system}.${cpuOrGpu}.${pyShortVersion}' attribute"); - platform = allHashAndPlatform."${stdenv.system}".platform; - src = fetchPypi ({ + allHashAndPlatform."${stdenv.hostPlatform.system}"."${cpuOrGpu}"."${pyShortVersion}" + or (throw "${pname} has no binary-hashes.nix entry for '${stdenv.hostPlatform.system}.${cpuOrGpu}.${pyShortVersion}' attribute"); + platform = allHashAndPlatform."${stdenv.hostPlatform.system}".platform; + src = fetchPypi { inherit version format @@ -46,7 +45,7 @@ let dist = pyShortVersion; python = pyShortVersion; abi = pyShortVersion; - }); + }; in buildPythonPackage { inherit @@ -56,40 +55,15 @@ buildPythonPackage { src ; - disabled = pythonOlder "3.9" || pythonAtLeast "3.11"; - - libraryPath = lib.makeLibraryPath ( - # TODO: remove openssl_1_1 and zlib, maybe by building paddlepaddle from - # source as suggested in the following comment: - # https://github.com/NixOS/nixpkgs/pull/243583#issuecomment-1641450848 - [ - openssl_1_1 - zlib - ] - ++ lib.optionals cudaSupport ( - with cudaPackages_11; - [ - cudatoolkit.lib - cudatoolkit.out - cudnn - ] - ) - ); - - postFixup = lib.optionalString stdenv.hostPlatform.isLinux '' - function fixRunPath { - p=$(patchelf --print-rpath $1) - patchelf --set-rpath "$p:$libraryPath" $1 - ${lib.optionalString cudaSupport '' - addDriverRunpath $1 - ''} - } - fixRunPath $out/${python.sitePackages}/paddle/fluid/libpaddle.so - ''; + disabled = + if cudaSupport then + (pythonOlder "3.11" || pythonAtLeast "3.13") + else + (pythonOlder "3.12" || pythonAtLeast "3.14"); nativeBuildInputs = [ addDriverRunpath ]; - propagatedBuildInputs = [ + dependencies = [ setuptools httpx numpy @@ -97,8 +71,8 @@ buildPythonPackage { pillow decorator astor - paddle-bfloat opt-einsum + typing-extensions ]; pythonImportsCheck = [ "paddle" ]; @@ -106,14 +80,45 @@ buildPythonPackage { # no tests doCheck = false; - meta = with lib; { - description = "PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署"; + postFixup = lib.optionalString stdenv.hostPlatform.isLinux ( + let + libraryPath = lib.makeLibraryPath ( + [ + zlib + (lib.getLib stdenv.cc.cc) + ] + ++ lib.optionals cudaSupport ( + with cudaPackages_11; + [ + cudatoolkit.lib + cudatoolkit.out + cudnn + ] + ) + ); + in + '' + function fixRunPath { + p=$(patchelf --print-rpath $1) + patchelf --set-rpath "$p:${libraryPath}" $1 + ${lib.optionalString cudaSupport '' + addDriverRunpath $1 + ''} + } + fixRunPath $out/${python.sitePackages}/paddle/base/libpaddle.so + fixRunPath $out/${python.sitePackages}/paddle/libs/lib*.so + '' + ); + + meta = { + description = "Machine Learning Framework from Industrial Practice"; homepage = "https://github.com/PaddlePaddle/Paddle"; - license = licenses.asl20; - maintainers = with maintainers; [ happysalada ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ happysalada ]; platforms = [ "x86_64-linux" ] - ++ optionals (!cudaSupport) [ + ++ lib.optionals (!cudaSupport) [ + "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];