python3Packages.torch{,-bin}: rename from pytorch{,-bin}

The proper name for a python package is the one in the setuptools
setup() call, which can also be seen on pypi.

Correct: https://pypi.org/project/torch/
Wrong: https://pypi.org/project/pytorch/

Includes a treewide rename of the attribute and creates aliases for the
old name.
This commit is contained in:
Martin Weinelt 2022-08-30 17:41:22 +02:00
parent 70c3bfea57
commit afe8ee8b47
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
46 changed files with 103 additions and 99 deletions

View File

@ -12,7 +12,7 @@
, ppx_sexp_conv
, sexplib
, stdio
, pytorch
, torch
}:
buildDunePackage rec {
@ -37,16 +37,16 @@ buildDunePackage rec {
ctypes
npy
ocaml-compiler-libs
pytorch
pytorch.dev
ppx_custom_printf
ppx_expect
ppx_sexp_conv
sexplib
stdio
torch
torch.dev
];
preBuild = "export LIBTORCH=${pytorch.dev}/";
preBuild = "export LIBTORCH=${torch.dev}/";
doCheck = !stdenv.isAarch64;
checkPhase = "dune runtest";
@ -56,6 +56,6 @@ buildDunePackage rec {
description = "Ocaml bindings to Pytorch";
maintainers = [ maintainers.bcdarwin ];
license = licenses.asl20;
broken = lib.versionAtLeast pytorch.version "1.11";
broken = lib.versionAtLeast torch.version "1.11";
};
}

View File

@ -12,7 +12,7 @@
, fn
, pyopengl
, seaborn
, pytorch
, torch
, pythonOlder
, torchvision
}:
@ -43,7 +43,7 @@ buildPythonPackage rec {
checkInputs = [
xvfb-run
pytorch
torch
torchvision
];

View File

@ -6,7 +6,7 @@
, coqpit
, fsspec
, pytorch-bin
, torch-bin
, tensorboardx
, protobuf
@ -33,7 +33,7 @@ buildPythonPackage {
propagatedBuildInputs = [
coqpit
fsspec
pytorch-bin
torch-bin
soundfile
tensorboardx
protobuf

View File

@ -1,7 +1,7 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, pytorch
, torch
, ninja
, scipy
, which
@ -48,7 +48,7 @@ buildPythonPackage rec {
export HOME=$(mktemp -d)
'';
propagatedBuildInputs = [ pytorch pybind11 ];
propagatedBuildInputs = [ torch pybind11 ];
checkInputs = [
which

View File

@ -8,7 +8,7 @@
, lib
, poetry
, pytestCheckHook
, pytorch
, torch
, pyyaml
, sh
, tables
@ -66,7 +66,7 @@ buildPythonPackage rec {
checkInputs = [
pytestCheckHook
pytorch
torch
sh
tensorflow
];

View File

@ -8,7 +8,7 @@
, scipy
, matplotlib
, scikit-learn
, pytorch
, torch
, pytestCheckHook
}:
@ -32,7 +32,7 @@ buildPythonPackage rec {
scipy
matplotlib
scikit-learn
pytorch
torch
];
checkInputs = [

View File

@ -5,7 +5,7 @@
, ninja
, pytestCheckHook
, python
, pytorch
, torch
, pybind11
, which
}:
@ -26,7 +26,7 @@ buildPythonPackage rec {
# `setup.py` imports `torch.utils.cpp_extension`.
nativeBuildInputs = [
ninja
pytorch
torch
which
];

View File

@ -8,7 +8,7 @@
, matplotlib
, mock
, packaging
, pytorch
, torch
, scikit-learn
, tqdm
}:
@ -25,7 +25,7 @@ buildPythonPackage rec {
};
checkInputs = [ pytestCheckHook matplotlib mock pytest-xdist torchvision ];
propagatedBuildInputs = [ packaging pytorch scikit-learn tqdm ];
propagatedBuildInputs = [ packaging torch scikit-learn tqdm ];
# runs succesfully in 3.9, however, async isn't correctly closed so it will fail after test suite.
doCheck = pythonOlder "3.9";

View File

@ -6,7 +6,7 @@
, ignite
, numpy
, pybind11
, pytorch
, torch
, which
}:
@ -33,7 +33,7 @@ buildPythonPackage rec {
nativeBuildInputs = [ ninja which ];
buildInputs = [ pybind11 ];
propagatedBuildInputs = [ numpy pytorch ignite ];
propagatedBuildInputs = [ numpy torch ignite ];
BUILD_MONAI = 1;

View File

@ -3,7 +3,6 @@
, fetchFromGitHub
, pytestCheckHook
, scikit-learn
, pytorch
}:
let

View File

@ -3,7 +3,7 @@
, buildPythonPackage
, numpy
, scipy
, pytorch
, torch
, autograd
, nose2
, matplotlib
@ -21,7 +21,7 @@ buildPythonPackage rec {
sha256 = "sha256-dqyduExNgXIbEFlgkckaPfhLFSVLqPgwAOyBUdowwiQ=";
};
propagatedBuildInputs = [ numpy scipy pytorch ];
propagatedBuildInputs = [ numpy scipy torch ];
checkInputs = [ nose2 autograd matplotlib tensorflow ];
checkPhase = ''

View File

@ -10,7 +10,7 @@
, pillow
, pyro-api
, pythonOlder
, pytorch
, torch
, scikit-learn
, seaborn
, torchvision
@ -32,7 +32,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [
pyro-api
pytorch
torch
networkx
opt-einsum
tqdm

View File

@ -6,7 +6,7 @@
, fsspec
, packaging
, pytestCheckHook
, pytorch
, torch
, pyyaml
, tensorboard
, torchmetrics
@ -29,7 +29,7 @@ buildPythonPackage rec {
packaging
future
fsspec
pytorch
torch
pyyaml
tensorboard
torchmetrics

View File

@ -5,7 +5,7 @@
, numpy
, scikit-learn
, pytestCheckHook
, pytorch
, torch
, torchvision
, tqdm
, faiss
@ -26,7 +26,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [
numpy
pytorch
torch
scikit-learn
torchvision
tqdm

View File

@ -5,7 +5,7 @@
, onnx
, packaging
, pytestCheckHook
, pytorch
, torch
, torchvision
, typing-extensions
}:
@ -21,7 +21,7 @@ buildPythonPackage rec {
sha256 = "sha256-w4WSEgNLdVLDnKS4kzJBK9BkrrGzbk2aCIhk4HCM/Bk=";
};
propagatedBuildInputs = [ numpy packaging pytorch typing-extensions ];
propagatedBuildInputs = [ numpy packaging torch typing-extensions ];
checkInputs = [ onnx pytestCheckHook torchvision ];

View File

@ -8,7 +8,7 @@
, pandas
, pillow
, six
, pytorch
, torch
, torchvision
, tqdm
, lib
@ -28,7 +28,7 @@ buildPythonPackage rec {
};
propagatedBuildInputs = [
h5py hickle numpy pandas pillow six pytorch torchvision tqdm
h5py hickle numpy pandas pillow six torch torchvision tqdm
];
checkInputs = [ pytest ];

View File

@ -13,7 +13,7 @@
, sparse
# Optional inputs
, withTorch ? true
, pytorch
, torch
# Check Inputs
, pytestCheckHook
, ddt
@ -41,7 +41,7 @@ buildPythonPackage rec {
qiskit-terra
scikit-learn
sparse
] ++ lib.optional withTorch pytorch;
] ++ lib.optional withTorch torch;
doCheck = false; # TODO: enable. Tests fail on unstable due to some multithreading issue?
checkInputs = [

View File

@ -6,7 +6,7 @@
, pytest-cov
, dill
, numpy
, pytorch
, torch
, threadpoolctl
, tqdm
}:
@ -24,7 +24,7 @@ buildPythonPackage rec {
sha256 = "15wYWToXRae1cMpHWbJwzAp0THx6ED9ixQgL+n1v9PI=";
};
propagatedBuildInputs = [ numpy pytorch threadpoolctl tqdm ];
propagatedBuildInputs = [ numpy torch threadpoolctl tqdm ];
checkInputs = [ dill pytest-cov pytestCheckHook ];
disabledTests = [ "test_affine" ]; # deprecated division operator '/'

View File

@ -7,7 +7,7 @@
, flaky
, numpy
, pandas
, pytorch
, torch
, scikit-learn
, scipy
, tabulate
@ -23,7 +23,7 @@ buildPythonPackage rec {
sha256 = "b35cb4e50045742f0ffcfad33044af691d5d36b50212573753a804483a947ca9";
};
propagatedBuildInputs = [ numpy pytorch scikit-learn scipy tabulate tqdm ];
propagatedBuildInputs = [ numpy torch scikit-learn scipy tabulate tqdm ];
checkInputs = [ pytest pytest-cov flaky pandas pytestCheckHook ];
disabledTests = [

View File

@ -4,7 +4,7 @@
, isPy27
, pytestCheckHook
, pandas
, pytorch
, torch
, scipy
}:
@ -18,7 +18,7 @@ buildPythonPackage rec {
sha256 = "f5d5f7b45f98d155b9c0ba6554fa9770c6b26d5793a3e77a1030fb56910ebeec";
};
checkInputs = [ pytestCheckHook pandas pytorch scipy ];
checkInputs = [ pytestCheckHook pandas torch scipy ];
disabledTests = [
# IndexError: too many indices for array

View File

@ -3,7 +3,7 @@
, fetchPypi
, buildPythonPackage
, dataclasses
, pytorch
, torch
, pythonOlder
, spacy
, spacy-alignments
@ -24,7 +24,7 @@ buildPythonPackage rec {
};
propagatedBuildInputs = [
pytorch
torch
spacy
spacy-alignments
srsly

View File

@ -7,7 +7,7 @@
, protobuf
, requests
, six
, pytorch
, torch
, tqdm
}:
@ -30,7 +30,7 @@ buildPythonPackage rec {
protobuf
requests
six
pytorch
torch
tqdm
];

View File

@ -10,7 +10,7 @@
, pillow
, protobuf3_8
, pytestCheckHook
, pytorch
, torch
, six
, soundfile
, tensorboard
@ -55,7 +55,7 @@ buildPythonPackage rec {
moto
pillow
pytestCheckHook
pytorch
torch
tensorboard
torchvision
];

View File

@ -7,7 +7,7 @@
, imageio
, numpy
, pandas
, pytorch
, torch
, tensorboard
}:
@ -33,7 +33,7 @@ buildPythonPackage rec {
imageio
numpy
pandas
pytorch
torch
tensorboard
];

View File

@ -3,7 +3,7 @@
, lib
, pandas
, pytestCheckHook
, pytorch
, torch
, tensorboard
, torchvision
}:
@ -27,7 +27,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ pandas tensorboard ];
checkInputs = [ pytestCheckHook pytorch torchvision ];
checkInputs = [ pytestCheckHook torch torchvision ];
disabledTests = [
# Tests that attempt to access the filesystem in naughty ways.

View File

@ -24,8 +24,8 @@ let
in buildPythonPackage {
inherit version;
pname = "pytorch";
# Don't forget to update pytorch to the same version.
pname = "torch";
# Don't forget to update torch to the same version.
format = "wheel";

View File

@ -1,4 +1,4 @@
# Warning: use the same CUDA version as pytorch-bin.
# Warning: use the same CUDA version as torch-bin.
#
# Precompiled wheels can be found at:
# https://download.pytorch.org/whl/torch_stable.html

View File

@ -120,8 +120,8 @@ let
"LD_LIBRARY_PATH=${cudaStub}\${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH ";
in buildPythonPackage rec {
pname = "pytorch";
# Don't forget to update pytorch-bin to the same version.
pname = "torch";
# Don't forget to update torch-bin to the same version.
version = "1.11.0";
format = "setuptools";

View File

@ -7,7 +7,7 @@
, isPy39
, isPy310
, python
, pytorch-bin
, torch-bin
, pythonOlder
, pythonAtLeast
}:
@ -26,7 +26,7 @@ buildPythonPackage rec {
disabled = !(isPy37 || isPy38 || isPy39 || isPy310);
propagatedBuildInputs = [
pytorch-bin
torch-bin
];
# The wheel-binary is not stripped to avoid the error of `ImportError: libtorch_cuda_cpp.so: ELF load command address/offset not properly aligned.`.
@ -38,7 +38,7 @@ buildPythonPackage rec {
# Note: after patchelf'ing, libcudart can still not be found. However, this should
# not be an issue, because PyTorch is loaded before torchvision and brings
# in the necessary symbols.
patchelf --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:${pytorch-bin}/${python.sitePackages}/torch/lib:" \
patchelf --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:${torch-bin}/${python.sitePackages}/torch/lib:" \
"$out/${python.sitePackages}/torchaudio/_torchaudio.so"
'';

View File

@ -1,4 +1,4 @@
# Warning: Need to update at the same time as pytorch-bin
# Warning: Need to update at the same time as torch-bin
#
# Precompiled wheels can be found at:
# https://download.pytorch.org/whl/torch_stable.html

View File

@ -4,7 +4,7 @@
, isPy27
, pytest-runner
, pytestCheckHook
, pytorch
, torch
}:
buildPythonPackage rec {
@ -20,7 +20,7 @@ buildPythonPackage rec {
sha256 = "0ki0njhmz1i3pkpr3y6h6ac7p5qh1kih06mknc2s18mfw34f2l55";
};
propagatedBuildInputs = [ pytorch ];
propagatedBuildInputs = [ torch ];
checkInputs = [ pytest-runner pytestCheckHook ];
disabledTests = [

View File

@ -3,7 +3,7 @@
, fetchFromGitHub
, pytestCheckHook
, pythonOlder
, pytorch
, torch
, torchvision
}:
@ -22,7 +22,7 @@ buildPythonPackage rec {
};
propagatedBuildInputs = [
pytorch
torch
torchvision
];

View File

@ -7,7 +7,7 @@
, packaging
, psutil
, py-deprecate
, pytorch
, torch
, pytestCheckHook
, torchmetrics
, pytorch-lightning
@ -34,7 +34,7 @@ buildPythonPackage {
# Let the user bring their own instance
buildInputs = [
pytorch
torch
];
checkInputs = [

View File

@ -9,7 +9,7 @@
, patchelf
, pillow
, python
, pytorch-bin
, torch-bin
}:
let
@ -34,7 +34,7 @@ in buildPythonPackage {
propagatedBuildInputs = [
pillow
pytorch-bin
torch-bin
];
# The wheel-binary is not stripped to avoid the error of `ImportError: libtorch_cuda_cpp.so: ELF load command address/offset not properly aligned.`.
@ -48,7 +48,7 @@ in buildPythonPackage {
# Note: after patchelf'ing, libcudart can still not be found. However, this should
# not be an issue, because PyTorch is loaded before torchvision and brings
# in the necessary symbols.
patchelf --set-rpath "${rpath}:${pytorch-bin}/${python.sitePackages}/torch/lib:" \
patchelf --set-rpath "${rpath}:${torch-bin}/${python.sitePackages}/torch/lib:" \
"$out/${python.sitePackages}/torchvision/_C.so"
'';

View File

@ -1,4 +1,4 @@
# Warning: use the same CUDA version as pytorch-bin.
# Warning: use the same CUDA version as torch-bin.
#
# Precompiled wheels can be found at:
# https://download.pytorch.org/whl/torch_stable.html

View File

@ -9,19 +9,19 @@
, numpy
, scipy
, pillow
, pytorch
, torch
, pytest
, cudaSupport ? pytorch.cudaSupport or false # by default uses the value from pytorch
, cudaSupport ? torch.cudaSupport or false # by default uses the value from torch
}:
let
inherit (pytorch.cudaPackages) cudatoolkit cudnn;
inherit (torch.cudaPackages) cudatoolkit cudnn;
cudatoolkit_joined = symlinkJoin {
name = "${cudatoolkit.name}-unsplit";
paths = [ cudatoolkit.out cudatoolkit.lib ];
};
cudaArchStr = lib.optionalString cudaSupport lib.strings.concatStringsSep ";" pytorch.cudaArchList;
cudaArchStr = lib.optionalString cudaSupport lib.strings.concatStringsSep ";" torch.cudaArchList;
in buildPythonPackage rec {
pname = "torchvision";
version = "0.13.0";
@ -42,7 +42,7 @@ in buildPythonPackage rec {
buildInputs = [ libjpeg_turbo libpng ]
++ lib.optionals cudaSupport [ cudnn ];
propagatedBuildInputs = [ numpy pillow pytorch scipy ];
propagatedBuildInputs = [ numpy pillow torch scipy ];
preBuild = lib.optionalString cudaSupport ''
export TORCH_CUDA_ARCH_LIST="${cudaArchStr}"

View File

@ -17,7 +17,7 @@
, scikit-learn
, pillow
, pyyaml
, pytorch
, torch
, tokenizers
, tqdm
}:
@ -67,7 +67,7 @@ buildPythonPackage rec {
# tf2onnx
];
torch = [
pytorch
torch
];
tokenizers = [
tokenizers

View File

@ -25,7 +25,7 @@
, pytestCheckHook
, python-dateutil
, pythonOlder
, pytorch
, torch
, pyyaml
, requests
, scikit-learn
@ -94,7 +94,7 @@ buildPythonPackage rec {
pytest-mock
pytest-xdist
pytestCheckHook
pytorch
torch
scikit-learn
tqdm
];

View File

@ -84,11 +84,11 @@ python.pkgs.buildPythonApplication rec {
pandas
pypinyin
pysbd
pytorch-bin
pyworld
scipy
soundfile
tensorflow
torch-bin
torchaudio-bin
tqdm
umap-learn

View File

@ -1232,7 +1232,7 @@ let
tls-mirage = callPackage ../development/ocaml-modules/tls/mirage.nix { };
torch = callPackage ../development/ocaml-modules/torch {
inherit (pkgs.python3Packages) pytorch;
inherit (pkgs.python3Packages) torch;
};
ocaml-protoc = callPackage ../development/ocaml-modules/ocaml-protoc { };

View File

@ -158,6 +158,10 @@ mapAliases ({
python-subunit = subunit; # added 2021-09-10
pytest_xdist = pytest-xdist; # added 2021-01-04
python_simple_hipchat = python-simple-hipchat; # added 2021-07-21
pytorch = torch; # added 2022-09-30
pytorch-bin = torch-bin; # added 2022-09-30
pytorchWithCuda = torchWithCuda; # added 2022-09-30
pytorchWithoutCuda = torchWithoutCuda; # added 2022-09-30
pytwitchapi = twitchapi; # added 2022-03-07
qasm2image = throw "qasm2image is no longer maintained (since November 2018), and is not compatible with the latest pythonPackages.qiskit versions."; # added 2020-12-09
qiskit-aqua = throw "qiskit-aqua has been removed due to deprecation, with its functionality moved to different qiskit packages";

View File

@ -9043,28 +9043,12 @@ in {
pytools = callPackage ../development/python-modules/pytools { };
pytorch = callPackage ../development/python-modules/pytorch {
cudaSupport = pkgs.config.cudaSupport or false;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;
inherit (pkgs.darwin) libobjc;
};
pytorch-bin = callPackage ../development/python-modules/pytorch/bin.nix { };
pytorch-lightning = callPackage ../development/python-modules/pytorch-lightning { };
pytorch-metric-learning = callPackage ../development/python-modules/pytorch-metric-learning { };
pytorch-pfn-extras = callPackage ../development/python-modules/pytorch-pfn-extras { };
pytorchWithCuda = self.pytorch.override {
cudaSupport = true;
};
pytorchWithoutCuda = self.pytorch.override {
cudaSupport = false;
};
pytraccar = callPackage ../development/python-modules/pytraccar { };
pytradfri = callPackage ../development/python-modules/pytradfri { };
@ -10931,6 +10915,23 @@ in {
toposort = callPackage ../development/python-modules/toposort { };
torch = callPackage ../development/python-modules/torch {
cudaSupport = pkgs.config.cudaSupport or false;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices;
inherit (pkgs.darwin) libobjc;
};
torch-bin = callPackage ../development/python-modules/torch/bin.nix { };
torchWithCuda = self.torch.override {
cudaSupport = true;
};
torchWithoutCuda = self.torch.override {
cudaSupport = false;
};
torch-tb-profiler = callPackage ../development/python-modules/torch-tb-profiler/default.nix { };
torchaudio-bin = callPackage ../development/python-modules/torchaudio/bin.nix { };

View File

@ -48,7 +48,7 @@ let
python3.pkgs.libgpuarray = linux;
python3.pkgs.tensorflowWithCuda = linux;
python3.pkgs.pyrealsense2WithCuda = linux;
python3.pkgs.pytorchWithCuda = linux;
python3.pkgs.torchWithCuda = linux;
python3.pkgs.jaxlib = linux;
}) // (genAttrs packageSets evalPackageSet));