1{ buildPythonPackage
2, fetchFromGitHub
3, lib
4, libjpeg
5, numba
6, opencv4
7, pandas
8, pkg-config
9, pytorch-pfn-extras
10, terminaltables
11, tqdm
12}:
13
14buildPythonPackage rec {
15 pname = "ffcv";
16 version = "0.0.3";
17
18 src = fetchFromGitHub {
19 owner = "libffcv";
20 repo = pname;
21 # See https://github.com/libffcv/ffcv/issues/158.
22 rev = "131d56235eca3f1497bb84eeaec82c3434ef25d8";
23 sha256 = "0f7q2x48lknnf98mqaa35my05qwvdgv0h8l9lpagdw6yhx0a6p2x";
24 };
25
26 # See https://github.com/libffcv/ffcv/issues/159.
27 postPatch = ''
28 substituteInPlace setup.py \
29 --replace "'assertpy'," "" \
30 --replace "'fastargs'," "" \
31 --replace "'imgcat'," "" \
32 --replace "'matplotlib'," "" \
33 --replace "'psutil'," "" \
34 --replace "'sklearn'," "" \
35 --replace "'webdataset'," ""
36 '';
37
38 nativeBuildInputs = [ pkg-config ];
39 buildInputs = [ libjpeg ];
40 propagatedBuildInputs = [ opencv4 numba pandas pytorch-pfn-extras terminaltables tqdm ];
41
42 # `ffcv._libffcv*.so` cannot be loaded in the nix build environment for some
43 # reason. See https://github.com/NixOS/nixpkgs/pull/160441#issuecomment-1045204722.
44 doCheck = false;
45
46 pythonImportsCheck = [ "ffcv" ];
47
48 meta = with lib; {
49 description = "FFCV: Fast Forward Computer Vision";
50 homepage = "https://ffcv.io";
51 license = licenses.asl20;
52 maintainers = with maintainers; [ samuela ];
53 };
54}