SpeysideHEP / spey

Smooth inference for reinterpretation studies
https://spey.readthedocs.io
MIT License
7 stars 1 forks source link

Python 3.12 compatibility issue #41

Closed jackaraz closed 2 months ago

jackaraz commented 2 months ago
          Thanks Jack! But in running it I get the error: python3.12/site-packages/spey/hypothesis_testing/asymptotic_calculator.py", line 81, in compute_asymptotic_confidence_level
CLsb_obs, CLb_obs, CLs_obs = pvalues(
                             ^^^^^^^^

File "....local/lib/python3.12/site-packages/spey/hypothesis_testing/utils.py", line 63, in pvalues CLsb = sig_plus_bkg_distribution.pvalue(delta_test_statistic) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "....local/lib/python3.12/site-packages/spey/hypothesis_testing/distributions.py", line 42, in pvalue return_value = multivariate_normal.cdf(self.shift - value) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/site-packages/scipy/stats/_multivariate.py", line 723, in cdf params = self._process_parameters(mean, cov, allow_singular) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/site-packages/scipy/stats/_multivariate.py", line 422, in _process_parameters psd = _PSD(cov, allow_singular=allow_singular) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/site-packages/scipy/stats/_multivariate.py", line 167, in init s, u = scipy.linalg.eigh(M, lower=lower, check_finite=check_finite) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib64/python3.12/site-packages/scipy/linalg/_decomp.py", line 560, in eigh w, v, other_args, info = drv(a=a1, drv_args, lwork_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _flapack.error: (liwork>=max(1,10n)||liwork==-1) failed for 10th keyword liwork: dsyevr:liwork=1

Originally posted by @mdgoodsell in https://github.com/SpeysideHEP/spey/issues/39#issuecomment-2208412969

jackaraz commented 2 months ago

Hi @mdgoodsell, can you give a more specific example? It passed all my tests, both in Linux and macOS, which tested from Python 3.8 to 3.12. So, I can not reproduce your issue. Maybe you are using a specific sub-version of 3.12? It looks like a scipy error; it is possible that they have some compatibility issues? That was the main reason why I didn't want to allow for higher versions of scipy :/

mdgoodsell commented 2 months ago

Sorry! Was a problem with scipy: https://github.com/Homebrew/homebrew-core/issues/164827 just needed to upgrade scipy to latest version. Happened with python 3.12.3 & scipy 1.11.3, fixed with scipy 1.14.0