about summary refs log tree commit diff
path: root/pkgs/development/python-modules/mxnet/default.nix
blob: 9ee3685511032201c874d2a2d32a22d512b2d401 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
  lib,
  buildPythonPackage,
  pkgs,
  requests,
  numpy,
  graphviz,
  python,
  isPy3k,
  isPy310,
}:

buildPythonPackage {
  inherit (pkgs.mxnet) pname version src;

  format = "setuptools";

  buildInputs = [ pkgs.mxnet ];
  propagatedBuildInputs = [
    requests
    numpy
    graphviz
  ];

  LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.mxnet ];

  doCheck = !isPy3k;

  postPatch = ''
    # Required to support numpy >=1.24 where np.bool is removed in favor of just bool
    substituteInPlace python/mxnet/numpy/utils.py \
      --replace "bool = onp.bool" "bool = bool"
    substituteInPlace python/setup.py \
      --replace "graphviz<0.9.0," "graphviz"
  '';

  preConfigure = ''
    cd python
  '';

  postInstall = ''
    rm -rf $out/mxnet
    ln -s ${pkgs.mxnet}/lib/libmxnet.so $out/${python.sitePackages}/mxnet
  '';

  meta = pkgs.mxnet.meta // {
    broken = (pkgs.mxnet.broken or false) || (isPy310 && pkgs.mxnet.cudaSupport);
  };
}