lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
218 stars 291 forks source link

CosmoSevereError after pip install classy #578

Open AlexandreBarthelemy opened 2 months ago

AlexandreBarthelemy commented 2 months ago

Hi,

I used to compile CLASS from source but I decided to try out the new pip install classy command with my new laptop (m1 mac in case the info is relevant). The installation runs without any issues, as well as importing the library.

I'm now trying to run this piece of code:

import classy
print(classy.__version__)
from classy import Class

cosmo = {
    'output':           'mPk',
    'P_k_max_1/Mpc':    100,
    'h':                0.7,
    'n_s':              0.97,
    'Omega_cdm':        0.233,
    'Omega_b':          0.046,
    'sigma8':           0.82,
    'N_ncdm':           0,
    'z_pk':             0.5, 
    'non linear':       'halofit'
}

cclass = Class()
cclass.set(cosmo)
cclass.compute()

but now runs into errors that were not present in my previous installation:

CosmoSevereError                          Traceback (most recent call last)
Cell In[4], line 21
     19 cclass = Class()
     20 cclass.set(cosmo)
---> 21 cclass.compute()

File /opt/miniconda3/lib/python3.9/site-packages/class_public/python/classy.pyx:364, in classy.Class.compute()

CosmoSevereError: 

Error in Class: input_read_from_file(L:422) :error in input_shooting(pfc,ppr,pba,pth,ppt,ptr,ppm,phr,pfo,ple,psd,pop, input_verbose, &has_shooting, errmsg);
=>input_shooting(L:836) :error in input_try_unknown_parameters(&A_s, 1, &fzw, &sigma8_or_S8, errmsg);
=>input_try_unknown_parameters(L:1416) :error in thermodynamics_init(&pr,&ba,&th);
=>thermodynamics_init(L:344) :error in thermodynamics_helium_from_bbn(ppr,pba,pth);
=>thermodynamics_helium_from_bbn(L:589) :could not open fA with name /Users/Alexandre/.local/lib/python3.9/site-packages/class_public/external/bbn/sBBN_2017.dat and mode "r"

Given that I'm not sure if those come from the pip install or just the switch from 3.1.2 to 3.2.3, could someone explain those to me and tell me what I'm eventually doing wrong ?

Thanks a lot for your help :)

AlexandreBarthelemy commented 2 months ago

Just for reference and additional information:

I just built the same class version (3.2.3) from source without installing any additional packages and the previously shown piece of code now runs without any issue. I thus think it's really an issue with the pip installation.