After installing SOLikeT and running "pytest -v ." as specified in the documentation, the tests for test_lensing.py and test_lensing_lite.py fail from the same failed installation of CLASS.
The error message indicates that the version for gcc is too low, needing to be newer than 6.4.
The entire error message is copied below:
'''
theory = 'classy'
@pytest.mark.parametrize("theory", ["camb", "classy"])
def test_lensing(theory):
> model, test_point = get_demo_lensing_model(theory)
soliket/tests/test_lensing.py:87:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
soliket/tests/test_lensing.py:64: in get_demo_lensing_model
install(info, path=packages_path, skip_global=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
infos = ({'likelihood': {'soliket.LensingLikelihood': {'stop_at_error': True}}, 'params': {'H0': {'prior': {'max': 100, 'min':...{'prior': {'max': 1.2, 'min': 0.8}}}, 'theory': {'classy': {'extra_args': {'output': 'lCl, tCl'}, 'path': 'global'}}},)
kwargs = {'path': '/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages', 'skip_global': True}
debug = None, path = '/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages'
abspath = '/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages'
kwargs_install = {'code': True, 'data': True, 'force': False, 'no_progress_bars': None}
what = 'data', spath = '/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages/data'
failed_components = ['theory:classy'], skip_keywords_arg = set(), skip_keywords_env = set()
skip_keywords = set()
def install(*infos, **kwargs):
debug = kwargs.get("debug")
# noinspection PyUnresolvedReferences
if not log.root.handlers:
logger_setup(debug=debug)
path = kwargs.get("path")
if not path:
path = resolve_packages_path(infos)
if not path:
raise LoggedError(
log, "No 'path' argument given, and none could be found in input infos "
"(as %r), the %r env variable or the config file. "
"Maybe specify one via a command line argument '-%s [...]'?",
"packages_path", packages_path_env, packages_path_arg[0])
abspath = os.path.abspath(path)
log.info("Installing external packages at '%s'", abspath)
kwargs_install = {"force": kwargs.get("force", False),
"no_progress_bars": kwargs.get("no_progress_bars")}
for what in (code_path, data_path):
kwargs_install[what] = kwargs.get(what, True)
spath = os.path.join(abspath, what)
if kwargs_install[what] and not os.path.exists(spath):
try:
os.makedirs(spath)
except OSError:
raise LoggedError(
log, "Could not create the desired installation folder '%s'", spath)
failed_components = []
skip_keywords_arg = set(kwargs.get("skip", []) or [])
# NB: if passed with quotes as `--skip "a b"`, it's interpreted as a single key
skip_keywords_arg = set(chain(*[word.split() for word in skip_keywords_arg]))
skip_keywords_env = set(
os.environ.get(install_skip_env, "").replace(",", " ").lower().split())
skip_keywords = skip_keywords_arg.union(skip_keywords_env)
used_components, components_infos = get_used_components(*infos, return_infos=True)
for kind, components in used_components.items():
for component in components:
print()
print(create_banner(kind + ":" + component,
symbol=_banner_symbol, length=_banner_length), end="")
print()
if _skip_helper(component.lower(), skip_keywords, skip_keywords_env, log):
continue
info = components_infos[component]
if isinstance(info, str) or "external" in info:
log.warning("Component '%s' is a custom function. "
"Nothing to do.", component)
continue
try:
class_name = (info or {}).get("class")
if class_name:
log.info("Class to be installed for this component: %r", class_name)
imported_class = get_resolved_class(
component, kind=kind, component_path=info.pop("python_path", None),
class_name=class_name)
except ImportError as excpt:
log.error("Component '%s' not recognized. [%s].", component, excpt)
failed_components += ["%s:%s" % (kind, component)]
continue
else:
if _skip_helper(imported_class.__name__.lower(), skip_keywords,
skip_keywords_env, log):
continue
is_compatible = getattr(imported_class, "is_compatible", lambda: True)()
if not is_compatible:
log.info(
"Skipping %r because it is not compatible with your OS.", component)
continue
log.info("Checking if dependencies have already been installed...")
is_installed = getattr(imported_class, "is_installed", None)
if is_installed is None:
log.info("%s.%s is a fully built-in component: nothing to do.",
kind, imported_class.__name__)
continue
install_path = abspath
get_path = getattr(imported_class, "get_path", None)
if get_path:
install_path = get_path(install_path)
has_been_installed = False
with NoLogging(None if debug else logging.ERROR):
if kwargs.get("skip_global"):
has_been_installed = is_installed(path="global", **kwargs_install)
if not has_been_installed:
has_been_installed = is_installed(path=install_path, **kwargs_install)
if has_been_installed:
log.info("External dependencies for this component already installed.")
if kwargs.get("test", False):
continue
if kwargs_install["force"] and not kwargs.get("skip_global"):
log.info("Forcing re-installation, as requested.")
else:
log.info("Doing nothing.")
continue
else:
log.info("Check found no existing installation")
if not debug:
log.info(
"(If you expected this to be already installed, re-run "
"`cobaya-install` with --debug to get more verbose output.)")
if kwargs.get("test", False):
continue
log.info("Installing...")
try:
install_this = getattr(imported_class, "install", None)
success = install_this(path=abspath, **kwargs_install)
except KeyboardInterrupt:
raise
except:
traceback.print_exception(*sys.exc_info(), file=sys.stdout)
log.error("An unknown error occurred. Delete the external packages "
"folder %r and try again. "
"Please, notify the developers if this error persists.",
abspath)
success = False
if success:
log.info("Successfully installed! Let's check it...")
else:
log.error("Installation failed! Look at the error messages above. "
"Solve them and try again, or, if you are unable to solve, "
"install the packages required by this component manually.")
failed_components += ["%s:%s" % (kind, component)]
continue
# test installation
with NoLogging(None if debug else logging.ERROR):
successfully_installed = is_installed(path=install_path, check=False,
**kwargs_install)
if not successfully_installed:
log.error("Installation apparently worked, "
"but the subsequent installation test failed! "
"Look at the error messages above, or re-run with --debug "
"for more more verbose output. "
"Try to solve the issues and try again, or, if you are unable "
"to solve them, install the packages required by this "
"component manually.")
failed_components += ["%s:%s" % (kind, component)]
else:
log.info("Installation check successful.")
print()
print(create_banner(" * Summary * ",
symbol=_banner_symbol, length=_banner_length), end="")
print()
if failed_components:
bullet = "\n - "
raise LoggedError(
log, "The installation (or installation test) of some component(s) has "
"failed: %s\nCheck output of the installer of each component above "
"for precise error info.\n",
> bullet + bullet.join(failed_components))
E cobaya.log.LoggedError: The installation (or installation test) of some component(s) has failed:
E - theory:classy
E Check output of the installer of each component above for precise error info.
../../.local/lib/python3.6/site-packages/cobaya/install.py:196: LoggedError
--------------------------------------- Captured stdout call ----------------------------------------
2022-03-01 15:37:29,071 [install] Installing external packages at '/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages'
================================================================================
theory:classy
================================================================================
2022-03-01 15:37:29,076 [install] Checking if dependencies have already been installed...
2022-03-01 15:37:29,078 [install] Check found no existing installation
2022-03-01 15:37:29,078 [install] (If you expected this to be already installed, re-run `cobaya-install` with --debug to get more verbose output.)
2022-03-01 15:37:29,078 [install] Installing...
2022-03-01 15:37:29,078 [classy] Installing pre-requisites...
Collecting cython
Downloading Cython-0.29.28-py2.py3-none-any.whl (983 kB)
Installing collected packages: cython
Successfully installed cython-0.29.28
2022-03-01 15:37:34,464 [classy] Downloading classy...
2022-03-01 15:37:37,982 [classy] Downloaded filename class_public-2.9.3.tar.gz
2022-03-01 15:37:38,177 [classy] class_public v2.9.3 downloaded and decompressed correctly.
2022-03-01 15:37:38,251 [classy] *ERROR* Your gcc version is too low! CLASS would probably compile, but it would leak memory when running a chain. Please use a gcc version newer than 6.4. You can still compile CLASS by hand, maybe changing the compiler in the Makefile. CLASS has been downloaded into '/private/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages/code/classy'
2022-03-01 15:37:38,252 [install] *ERROR* Installation failed! Look at the error messages above. Solve them and try again, or, if you are unable to solve, install the packages required by this component manually.
================================================================================
likelihood:soliket.LensingLikelihood
================================================================================
2022-03-01 15:37:38,253 [install] Checking if dependencies have already been installed...
2022-03-01 15:37:38,254 [install] External dependencies for this component already installed.
2022-03-01 15:37:38,254 [install] Doing nothing.
================================================================================
* Summary *
================================================================================
2022-03-01 15:37:38,254 [install] *ERROR* The installation (or installation test) of some component(s) has failed:
- theory:classy
Check output of the installer of each component above for precise error info.
--------------------------------------- Captured stderr call ----------------------------------------
3.31MiB [00:02, 1.16MiB/s]
----------------------------------------- Captured log call -----------------------------------------
INFO install:install.py:64 Installing external packages at '/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages'
INFO install:install.py:117 Checking if dependencies have already been installed...
INFO install:install.py:143 Check found no existing installation
INFO install:install.py:146 (If you expected this to be already installed, re-run `cobaya-install` with --debug to get more verbose output.)
INFO install:install.py:150 Installing...
INFO classy:classy.py:573 Installing pre-requisites...
INFO classy:classy.py:578 Downloading classy...
INFO classy:install.py:242 Downloaded filename class_public-2.9.3.tar.gz
INFO classy:install.py:292 class_public v2.9.3 downloaded and decompressed correctly.
ERROR classy:classy.py:595 Your gcc version is too low! CLASS would probably compile, but it would leak memory when running a chain. Please use a gcc version newer than 6.4. You can still compile CLASS by hand, maybe changing the compiler in the Makefile. CLASS has been downloaded into '/private/var/folders/15/lt28zrgs54nbr15_scf2bjtm0000gn/T/lensing_packages/code/classy'
ERROR install:install.py:166 Installation failed! Look at the error messages above. Solve them and try again, or, if you are unable to solve, install the packages required by this component manually.
INFO install:install.py:117 Checking if dependencies have already been installed...
INFO install:install.py:134 External dependencies for this component already installed.
INFO install:install.py:140 Doing nothing.
ERROR install:log.py:35 The installation (or installation test) of some component(s) has failed:
- theory:classy
Check output of the installer of each component above for precise error info.
_______________________________________ test_lensing[classy] ________________________________________
theory = 'classy'
@pytest.mark.parametrize("theory", ["camb", "classy"])
def test_lensing(theory):
> model = get_demo_lensing_model(theory)
soliket/tests/test_lensing_lite.py:61:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
soliket/tests/test_lensing_lite.py:55: in get_demo_lensing_model
model = get_model(info)
../../.local/lib/python3.6/site-packages/cobaya/model.py:1189: in get_model
stop_at_error=info.get("stop_at_error", False))
../../.local/lib/python3.6/site-packages/cobaya/model.py:150: in __init__
timing=timing)
../../.local/lib/python3.6/site-packages/cobaya/theory.py:397: in __init__
info, packages_path=packages_path, timing=timing, name=name))
../../.local/lib/python3.6/site-packages/cobaya/theory.py:67: in __init__
standalone=standalone)
../../.local/lib/python3.6/site-packages/cobaya/component.py:95: in __init__
self.initialize()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = classy
def initialize(self):
"""Importing CLASS from the correct path, if given, and if not, globally."""
# Allow global import if no direct path specification
allow_global = not self.path
if not self.path and self.packages_path:
self.path = self.get_path(self.packages_path)
self.classy_module = self.is_installed(path=self.path, allow_global=allow_global,
check=False)
if not self.classy_module:
raise NotInstalledError(
> self.log, "Could not find CLASS. Check error message above.")
E cobaya.install.NotInstalledError: Could not find CLASS. Check error message above.
../../.local/lib/python3.6/site-packages/cobaya/theories/classy/classy.py:186: NotInstalledError
--------------------------------------- Captured stdout call ----------------------------------------
2022-03-01 15:37:41,379 [classy] Importing *global* CLASS.
2022-03-01 15:37:41,381 [classy] *ERROR* Could not import global CLASS installation. Specify a Cobaya or CLASS installation path, or install the CLASS Python interface globally with 'cd /path/to/class/python/ ; python setup.py install'
2022-03-01 15:37:41,381 [classy] *ERROR* Could not find CLASS. Check error message above.
----------------------------------------- Captured log call -----------------------------------------
INFO classy:classy.py:545 Importing *global* CLASS.
ERROR classy:classy.py:558 Could not import global CLASS installation. Specify a Cobaya or CLASS installation path, or install the CLASS Python interface globally with 'cd /path/to/class/python/ ; python setup.py install'
ERROR classy:log.py:35 Could not find CLASS. Check error message above.
====================================== short test summary info ======================================
FAILED soliket/tests/test_lensing.py::test_lensing[classy] - cobaya.log.LoggedError: The installat...
FAILED soliket/tests/test_lensing_lite.py::test_lensing[classy] - cobaya.install.NotInstalledError...
'''