Skip to content

Commit 4edfdbe

Browse files
authored
Merge pull request #3574 from Flamefire/fix-pytorch-build
Fix building PyTorch when using `setup.py` as the build command
2 parents 4ce0929 + 7ba107b commit 4edfdbe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

easybuild/easyblocks/generic/pythonpackage.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ def __init__(self, *args, **kwargs):
474474
self.pylibdir = UNKNOWN
475475
self.all_pylibdirs = [UNKNOWN]
476476

477-
self.py_installopts = []
478477
self.install_cmd_output = ''
479478

480479
# make sure there's no site.cfg in $HOME, because setup.py will find it and use it
@@ -499,8 +498,6 @@ def __init__(self, *args, **kwargs):
499498
# figure out whether this Python package is being installed for multiple Python versions
500499
self.multi_python = 'Python' in self.cfg['multi_deps']
501500

502-
# determine install command
503-
self.use_setup_py = False
504501
self.determine_install_command()
505502

506503
# avoid that pip (ab)uses $HOME/.cache/pip
@@ -522,7 +519,9 @@ def determine_install_command(self):
522519
"""
523520
Determine install command to use.
524521
"""
522+
self.py_installopts = []
525523
if self.cfg.get('use_pip', True) or self.cfg.get('use_pip_editable', False):
524+
self.use_setup_py = False
526525
self.install_cmd = PIP_INSTALL_CMD
527526

528527
pip_verbose = self.cfg.get('pip_verbose', None)
@@ -551,8 +550,8 @@ def determine_install_command(self):
551550
else:
552551
self.use_setup_py = True
553552
self.install_cmd = SETUP_PY_INSTALL_CMD
554-
install_target = self.cfg.get_ref('install_target')
555553

554+
install_target = self.cfg.get_ref('install_target')
556555
if install_target == EASY_INSTALL_TARGET:
557556
self.install_cmd += " %(loc)s"
558557
self.py_installopts.append('--no-deps')

easybuild/easyblocks/p/pytorch.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def __init__(self, *args, **kwargs):
240240
if self.cfg['use_pip'] is None and pytorch_version >= '2.0':
241241
self.log.info("Auto-enabling use of pip to install PyTorch >= 2.0, since 'use_pip' is not set")
242242
self.cfg['use_pip'] = True
243+
self.determine_install_command()
243244

244245
# Set extra environment variables for PyTorch
245246
# use glob pattern as self.pylibdir is unknown at this stage

0 commit comments

Comments
 (0)