From baa0d63d54e01c43e7bd65a507506d4abf289dcf Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Wed, 17 Jan 2024 14:25:41 +0100 Subject: [PATCH 1/2] disable use_pip by default for PyTorch, except for recent versions (>= 2.1) --- easybuild/easyblocks/p/pytorch.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/easybuild/easyblocks/p/pytorch.py b/easybuild/easyblocks/p/pytorch.py index 62172fca10..6fe0c01901 100644 --- a/easybuild/easyblocks/p/pytorch.py +++ b/easybuild/easyblocks/p/pytorch.py @@ -54,8 +54,14 @@ def extra_options(): 'excluded_tests': [{}, "Mapping of architecture strings to list of tests to be excluded", CUSTOM], 'max_failed_tests': [0, "Maximum number of failing tests", CUSTOM], }) + + # disable use of pip to install PyTorch by default, overwriting the default set in PythonPackage; + # see also https://github.com/easybuilders/easybuild-easyblocks/pull/3022 + extra_vars['use_pip'][0] = None + extra_vars['download_dep_fail'][0] = True extra_vars['sanity_pip_check'][0] = True + # Make pip show output of build process as that may often contain errors or important warnings extra_vars['pip_verbose'][0] = True @@ -69,6 +75,13 @@ def __init__(self, *args, **kwargs): self.testinstall = True self.tmpdir = tempfile.mkdtemp(suffix='-pytorch-build') + # opt-in to using pip to install PyTorch for sufficiently recent version (>= 2.1), + # unless it's otherwise specified + pytorch_version = LooseVersion(self.version) + if self.cfg['use_pip'] is None and pytorch_version >= '2.1': + self.log.info("Auto-enabling use of pip to install PyTorch, since 'use_pip' is not set") + self.cfg['use_pip'] = True + def fetch_step(self, skip_checksums=False): """Fetch sources for installing PyTorch, including those for tests.""" super(EB_PyTorch, self).fetch_step(skip_checksums) From 90e32627695feaa8c7de671eda10cf918af8ffcd Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 19 Jan 2024 14:56:48 +0100 Subject: [PATCH 2/2] auto-enable use_pip for PyTorch >= 2.0 --- easybuild/easyblocks/p/pytorch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/easybuild/easyblocks/p/pytorch.py b/easybuild/easyblocks/p/pytorch.py index 6fe0c01901..11c2490371 100644 --- a/easybuild/easyblocks/p/pytorch.py +++ b/easybuild/easyblocks/p/pytorch.py @@ -75,11 +75,11 @@ def __init__(self, *args, **kwargs): self.testinstall = True self.tmpdir = tempfile.mkdtemp(suffix='-pytorch-build') - # opt-in to using pip to install PyTorch for sufficiently recent version (>= 2.1), + # opt-in to using pip to install PyTorch for sufficiently recent version (>= 2.0), # unless it's otherwise specified pytorch_version = LooseVersion(self.version) - if self.cfg['use_pip'] is None and pytorch_version >= '2.1': - self.log.info("Auto-enabling use of pip to install PyTorch, since 'use_pip' is not set") + if self.cfg['use_pip'] is None and pytorch_version >= '2.0': + self.log.info("Auto-enabling use of pip to install PyTorch >= 2.0, since 'use_pip' is not set") self.cfg['use_pip'] = True def fetch_step(self, skip_checksums=False):