Installation of Planck18 in Cobaya fails with git version

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Post Reply
Natalie Hogg
Posts: 5
Joined: September 04 2020
Affiliation: IPht CEA Paris-Saclay

Installation of Planck18 in Cobaya fails with git version

Post by Natalie Hogg »

Hi all,

I have installed cobaya by cloning my fork of the git repo since I'm interested in adding a new internal likelihood. Everything works until I try installing the Planck 2018 likelihood in the way described here: https://cobaya.readthedocs.io/en/latest/installation_cosmo.html#installing-a-basic-set-of-codes-and-likelihoods.

The following exception is raised (full traceback below):

Code: Select all

 File "/home/natalie/anaconda3/lib/python3.11/site-packages/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '5d72efcb7d19
but the version number that's quoted as invalid is actually the first part of the hash for the latest commit on the cobaya repo, https://github.com/nataliehogg/cobaya/commit/5d72efcb7d19b65df6e9cdce333746a24d5443eb.

I presume this is a bug -- is there any workaround? If not I can try using the new likelihood externally with a pip-installed version of cobaya (presuming that will not yield the same error).

Full traceback:

Code: Select all

(base) natalie@lazarus:~/Projects/slide/cobaya$  cobaya-install planck_2018_highl_plik.TTTEEE
[install] Installing external packages at '/home/natalie/Projects/slide/cobaya/cobaya/likelihoods'
[install] The installation path has been written into the global config file: /home/natalie/.config/cobaya/config.yaml

================================================================================
planck_2018_highl_plik.TTTEEE
================================================================================

[install] Checking if dependencies have already been installed...
[exception handler] ---------------------------------------

Traceback (most recent call last):
  File "/home/natalie/.local/bin/cobaya-install", line 33, in <module>
    sys.exit(load_entry_point('cobaya==3.3.2', 'console_scripts', 'cobaya-install')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/install.py", line 635, in install_script
    install(*infos, path=getattr(arguments, packages_path_arg), logger=logger,
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/install.py", line 263, in install
    has_been_installed = is_installed(
                         ^^^^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/likelihoods/base_classes/planck_clik.py", line 161, in is_installed
    result &= bool(is_installed_clik(
                   ^^^^^^^^^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/likelihoods/base_classes/planck_clik.py", line 310, in is_installed_clik
    return bool(load_clik(
                ^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/likelihoods/base_classes/planck_clik.py", line 299, in load_clik
    clik = load_external_module(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/component.py", line 809, in load_external_module
    module = _bare_load_external_module(not_installed_level="debug", **load_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/component.py", line 732, in _bare_load_external_module
    import_path = get_import_path(path)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/home/natalie/.local/lib/python3.11/site-packages/cobaya-3.3.2-py3.11.egg/cobaya/likelihoods/base_classes/planck_clik.py", line 282, in get_clik_import_path
    installed_version = version.parse(f.readline().split("_")[-1].split('-')[0])
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/natalie/anaconda3/lib/python3.11/site-packages/packaging/version.py", line 52, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "/home/natalie/anaconda3/lib/python3.11/site-packages/packaging/version.py", line 197, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '5d72efcb7d19
'
-------------------------------------------------------------
Antony Lewis
Posts: 1987
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

Re: Installation of Planck18 in Cobaya fails with git version

Post by Antony Lewis »

What's in the svnversion file in your downloaded clik folder?
Post Reply