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

Add scipy (and maybe h5py) to requirements #140

Open
MJKirk opened this issue Jun 27, 2024 · 5 comments
Open

Add scipy (and maybe h5py) to requirements #140

MJKirk opened this issue Jun 27, 2024 · 5 comments

Comments

@MJKirk
Copy link
Contributor

MJKirk commented Jun 27, 2024

Without scipy installed, if you pip install ultranest and then try and import it, it fails since ultranest/hotstart.py is imported (via the __init__.py and then ultranest/integrator.py) and the hotstart.py file tries to import scipy:

import scipy.stats

So scipy should be added to setup.py as a requirement.

In addition, if you enable logging via the log_dir argument, the default is to use HDF5 as the output format

storage_backend='hdf5',

so you can quickly get another failure if you don't have h5py installed.
I would say it therefore makes sense to either also add h5py as a requirement, or switch the default to csv/tsv.

Happy to make a PR if you agree

@JohannesBuchner
Copy link
Owner

Hmm, I think the first three get_ functions in ultranest.hotstart could import scipy.stats.t when called. I'd rather not have scipy as a hard requirement, only when some of its functions are needed (integrator.py does not need it).
Similarly for hdf5.

hdf5 and scipy, being binary libraries, can be quite difficult to install on some legacy systems. Some users may be happy with non-storage functionality.

@JohannesBuchner
Copy link
Owner

By the way, the conda package does have scipy as a run requirement, since conda can ensure a scipy install (pip not necessarily). https://github.com/conda-forge/ultranest-feedstock/blob/main/recipe/meta.yaml

@MJKirk
Copy link
Contributor Author

MJKirk commented Jun 28, 2024

Fair enough, I understand not wanting scipy and hdf5 as default requirements for those reasons.
What do you think about switching the default storage backend away from hdf5 then though?

@JohannesBuchner
Copy link
Owner

The default is to not store, you have to opt in to storing by setting log_dir.

@MJKirk
Copy link
Contributor Author

MJKirk commented Jul 1, 2024

Yes, my point was just that once you do switch on logging by setting that option, a "standard" user will likely immediately get an error, since the code uses HDF5 by default but this is not installed with ultranest.
It just seems like not very friendly user behaviour to me. But I suppose it's not a big issue, as the error they get is relatively obvious to interpret.

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

2 participants