nixpkgs/pkgs/development/python-modules/torchvision/default.nix

51 lines
1.0 KiB
Nix
Raw Normal View History

2020-12-29 23:04:35 +00:00
{ stdenv
, buildPythonPackage
, fetchFromGitHub
, ninja
, which
, libjpeg_turbo
, libpng
2017-08-19 08:47:23 +01:00
, numpy
2020-12-29 23:04:35 +00:00
, scipy
2017-08-19 08:47:23 +01:00
, pillow
, pytorch
, pytest
}:
2017-08-19 08:47:23 +01:00
buildPythonPackage rec {
2020-12-29 23:04:35 +00:00
pname = "torchvision";
version = "0.8.2";
2017-08-19 08:47:23 +01:00
2020-12-29 23:04:35 +00:00
src = fetchFromGitHub {
owner = "pytorch";
repo = "vision";
rev = "v${version}";
sha256 = "0yhpbq7linrk2qp5jxsvlgkmwa5bn38s9kcswy4jzvmx1fjbkpq0";
2017-08-19 08:47:23 +01:00
};
2020-12-29 23:04:35 +00:00
nativeBuildInputs = [ libpng ninja which ];
TORCHVISION_INCLUDE = "${libjpeg_turbo.dev}/include/";
TORCHVISION_LIBRARY = "${libjpeg_turbo}/lib/";
2020-12-29 23:04:35 +00:00
buildInputs = [ libjpeg_turbo libpng ];
propagatedBuildInputs = [ numpy pillow pytorch scipy ];
# tries to download many datasets for tests
2020-12-29 23:04:35 +00:00
doCheck = false;
checkPhase = ''
HOME=$TMPDIR py.test test --ignore=test/test_datasets_download.py
'';
2020-12-29 23:04:35 +00:00
checkInputs = [ pytest ];
2017-08-19 08:47:23 +01:00
2020-12-29 23:04:35 +00:00
meta = with stdenv.lib; {
2017-08-19 08:47:23 +01:00
description = "PyTorch vision library";
2020-12-29 23:04:35 +00:00
homepage = "https://pytorch.org/";
license = licenses.bsd3;
maintainers = with maintainers; [ ericsagnes SuperSandro2000 ];
2017-08-19 08:47:23 +01:00
};
}