16 pyVerNoDot = builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
17 srcs = import ./binary-hashes.nix version;
18 unsupported = throw "Unsupported system";
20 in buildPythonPackage {
23 pname = "torchvision";
27 src = fetchurl srcs."${stdenv.system}-${pyVerNoDot}" or unsupported;
29 disabled = !(isPy37 || isPy38 || isPy39 || isPy310);
35 propagatedBuildInputs = [
40 # The wheel-binary is not stripped to avoid the error of `ImportError: libtorch_cuda_cpp.so: ELF load command address/offset not properly aligned.`.
43 pythonImportsCheck = [ "torchvision" ];
46 rpath = lib.makeLibraryPath [ stdenv.cc.cc.lib ];
48 # Note: after patchelf'ing, libcudart can still not be found. However, this should
49 # not be an issue, because PyTorch is loaded before torchvision and brings
50 # in the necessary symbols.
51 patchelf --set-rpath "${rpath}:${torch-bin}/${python.sitePackages}/torch/lib:" \
52 "$out/${python.sitePackages}/torchvision/_C.so"
56 description = "PyTorch vision library";
57 homepage = "https://pytorch.org/";
58 changelog = "https://github.com/pytorch/vision/releases/tag/v${version}";
59 # Includes CUDA and Intel MKL, but redistributions of the binary are not limited.
60 # https://docs.nvidia.com/cuda/eula/index.html
61 # https://www.intel.com/content/www/us/en/developer/articles/license/onemkl-license-faq.html
62 license = licenses.bsd3;
63 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
64 platforms = platforms.linux;
65 maintainers = with maintainers; [ junjihashimoto ];