Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not exactly an installation issue, but related to confusing error messages when running Firecrown for the first time without having set {FIRECROWN_DIR} to point to the correct directory. The final error message seen by the user is distracting from the actual issue. #175

Closed
marcpaterno opened this issue Aug 12, 2022 · 3 comments

Comments

@marcpaterno
Copy link
Collaborator

Not exactly an installation issue, but related to confusing error messages when running Firecrown for the first time without having set {FIRECROWN_DIR} to point to the correct directory. The final error message seen by the user is distracting from the actual issue.

Here when running "cobaya-run cobaya_evaluate.yaml" (but apparently also applicable to cosmosis):

<...>

FileNotFoundError: [Errno 2] No such file or directory: '${FIRECROWN_DIR}/examples/des_y1_3x2pt/des_y1_3x2pt_sacc_data.fits'
The above exception was the direct cause of the following exception:

<...>

 File "/Users/agne/opt/anaconda3/envs/fc/lib/python3.10/site-packages/firecrown/likelihood/likelihood.py", line 105, in load_likelihood
    raise ImportError(f"{e.strerror}: {filename}") from e
ImportError: No such file or directory: des_y1_3x2pt.py

Originally posted by @agnesemenaite in #172 (comment)

@marcpaterno
Copy link
Collaborator Author

This is a problem caused by the fact that we have code that can fail being executed at import time. We should change the design of our "factory function" scripts to be instead python modules that declare a factory function (that returns the likelihood object). This will make it easier to detect this kind of failure and to product a meaningful error message.

@tilmantroester
Copy link
Contributor

I think the issue is that FileNotFoundError gets caught and then re-raised as an unhelpful ImportError here: https://github.com/LSSTDESC/firecrown/blob/master/firecrown/likelihood/likelihood.py#L104
See the MWE in the other issue I opened on this: #173
Other exceptions being raised just show up as one would expect, it's just FileNotFoundError (which are very common) that get obfuscated.

@vitenti
Copy link
Collaborator

vitenti commented May 8, 2023

Fixed by PR #207

@vitenti vitenti closed this as completed May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants