diff --git a/easybuild/easyblocks/generic/pythonbundle.py b/easybuild/easyblocks/generic/pythonbundle.py index 17287d17bb..76e4e3d200 100644 --- a/easybuild/easyblocks/generic/pythonbundle.py +++ b/easybuild/easyblocks/generic/pythonbundle.py @@ -111,19 +111,16 @@ def prepare_step(self, *args, **kwargs): python_cmd = pick_python_cmd(req_maj_ver=req_py_majver, req_min_ver=req_py_minver) - if python_cmd: - self.log.info("Python command being used: %s", python_cmd) - else: - if req_py_majver is not None or req_py_minver is not None: + # If pick_python_cmd didn't find a (system) python command, we should raise an error + if python_cmd: + self.log.info("Python command being used: %s", python_cmd) + else: raise EasyBuildError( "Failed to pick python command that satisfies requirements in the EasyConfigs " "(req_py_majver = %s, req_py_minver = %s)", req_py_majver, req_py_minver ) - else: - raise EasyBuildError("Failed to pick Python command to use") - if python_cmd: - self.all_pylibdirs = get_pylibdirs(python_cmd=python_cmd) + self.all_pylibdirs = get_pylibdirs(python_cmd=python_cmd) self.pylibdir = self.all_pylibdirs[0] # if 'python' is not used, we need to take that into account in the extensions filter