Bug#1078417: symfit: FTBFS: with pytest.raises(NameError):

Lucas Nussbaum lucas at debian.org
Sat Aug 10 07:11:05 BST 2024


Source: symfit
Version: 0.5.6-3
Severity: serious
Justification: FTBFS
Tags: trixie sid ftbfs
User: lucas at debian.org
Usertags: ftbfs-20240809 ftbfs-trixie

Hi,

During a rebuild of all packages in sid, your package failed to build
on amd64.


Relevant part (hopefully):
> make[1]: Entering directory '/<<PKGBUILDDIR>>'
> dh_auto_test
> I: pybuild base:311: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build; python3.12 -m pytest tests
> ============================= test session starts ==============================
> platform linux -- Python 3.12.5, pytest-8.3.2, pluggy-1.5.0
> rootdir: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build
> configfile: pytest.ini
> collected 123 items
> 
> tests/test_argument.py ....                                              [  3%]
> tests/test_auto_fit.py ......                                            [  8%]
> tests/test_constrained.py .....s............                             [ 22%]
> tests/test_distributions.py ..                                           [ 24%]
> tests/test_finite_difference.py ........                                 [ 30%]
> tests/test_fit_result.py ..........                                      [ 39%]
> tests/test_general.py .........s.........F....s......                    [ 64%]
> tests/test_global_opt.py ....                                            [ 67%]
> tests/test_minimize.py ......                                            [ 72%]
> tests/test_minimizers.py .......                                         [ 78%]
> tests/test_model.py ............                                         [ 87%]
> tests/test_objectives.py .....                                           [ 91%]
> tests/test_ode.py ........                                               [ 98%]
> tests/test_support.py ..                                                 [100%]
> 
> =================================== FAILURES ===================================
> __________________ test_likelihood_fitting_bivariate_gaussian __________________
> 
>     def test_likelihood_fitting_bivariate_gaussian():
>         """
>         Fit using the likelihood method.
>         """
>         # Make variables and parameters
>         x = Variable('x')
>         y = Variable('y')
>         x0 = Parameter('x0', value=0.6, min=0.5, max=0.7)
>         sig_x = Parameter('sig_x', value=0.1, max=1.0)
>         y0 = Parameter('y0', value=0.7, min=0.6, max=0.9)
>         sig_y = Parameter('sig_y', value=0.05, max=1.0)
>         rho = Parameter('rho', value=0.001, min=-1, max=1)
>     
>         pdf = BivariateGaussian(x=x, mu_x=x0, sig_x=sig_x, y=y, mu_y=y0,
>                                 sig_y=sig_y, rho=rho)
>     
>         # Draw 100000 samples from a bivariate distribution
>         mean = [0.59, 0.8]
>         r = 0.6
>         cov = np.array([[0.11 ** 2, 0.11 * 0.23 * r],
>                         [0.11 * 0.23 * r, 0.23 ** 2]])
>         np.random.seed(42)
>         # TODO: Do we really need 100k points?
>         xdata, ydata = np.random.multivariate_normal(mean, cov, 100000).T
>     
>         fit = Fit(pdf, x=xdata, y=ydata, objective=LogLikelihood)
>         fit_result = fit.execute()
>     
>         assert fit_result.value(x0) == pytest.approx(mean[0], 1e-2)
>         assert fit_result.value(y0) == pytest.approx(mean[1], 1e-2)
>         assert fit_result.value(sig_x) == pytest.approx(np.sqrt(cov[0, 0]), 1e-2)
>         assert fit_result.value(sig_y) == pytest.approx(np.sqrt(cov[1, 1]), 1e-2)
>         assert fit_result.value(rho) == pytest.approx(r, 1e-2)
>     
>         marginal = integrate(pdf, (y, -oo, oo), conds='none')
>         fit = Fit(marginal, x=xdata, objective=LogLikelihood)
>     
>         with pytest.raises(NameError):
>             # Should raise a NameError, not a TypeError, see #219
> >           fit.execute()
> 
> tests/test_general.py:615: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> symfit/core/fit.py:573: in execute
>     minimizer_ans = self.minimizer.execute(**minimize_options)
> symfit/core/minimizers.py:400: in execute
>     return super(ScipyGradientMinimize, self).execute(jacobian=jacobian, **minimize_options)
> symfit/core/minimizers.py:419: in execute
>     return super(ScipyBoundedMinimizer, self).execute(bounds=self.bounds,
> symfit/core/minimizers.py:339: in execute
>     ans = minimize(
> /usr/lib/python3/dist-packages/scipy/optimize/_minimize.py:713: in minimize
>     res = _minimize_lbfgsb(fun, x0, args, jac, bounds,
> /usr/lib/python3/dist-packages/scipy/optimize/_lbfgsb_py.py:347: in _minimize_lbfgsb
>     sf = _prepare_scalar_function(fun, x0, jac=jac, args=args, epsilon=eps,
> /usr/lib/python3/dist-packages/scipy/optimize/_optimize.py:288: in _prepare_scalar_function
>     sf = ScalarFunction(fun, x0, args, grad, hess,
> /usr/lib/python3/dist-packages/scipy/optimize/_differentiable_functions.py:166: in __init__
>     self._update_fun()
> /usr/lib/python3/dist-packages/scipy/optimize/_differentiable_functions.py:262: in _update_fun
>     self._update_fun_impl()
> /usr/lib/python3/dist-packages/scipy/optimize/_differentiable_functions.py:163: in update_fun
>     self.f = fun_wrapped(self.x)
> /usr/lib/python3/dist-packages/scipy/optimize/_differentiable_functions.py:145: in fun_wrapped
>     fx = fun(np.copy(x), *args)
> symfit/core/objectives.py:454: in __call__
>     evaluated_func = super(LogLikelihood, self).__call__(
> symfit/core/objectives.py:93: in __call__
>     result = self.model(**key2str(parameters))._asdict()
> symfit/core/models.py:706: in __call__
>     return ModelOutput(self.keys(), self.eval_components(*args, **kwargs))
> symfit/core/models.py:654: in eval_components
>     kwargs[symbol.name] = components[symbol](**dependencies_kwargs)
> <lambdifygenerated-1398>:2: in _lambdifygenerated
>     return (1/2)*exp(-x0**2/(-2*rho**2*sig_x**2 + 2*sig_x**2))*exp(-y0**2/(-2*rho**2*sig_y**2 + 2*sig_y**2))*exp(-x**2/(-2*rho**2*sig_x**2 + 2*sig_x**2))*exp(2*x0*x/(-2*rho**2*sig_x**2 + 2*sig_x**2))*exp(2*rho*x0*y0/(-2*rho**2*sig_x*sig_y + 2*sig_x*sig_y))*exp(-2*rho*y0*x/(-2*rho**2*sig_x*sig_y + 2*sig_x*sig_y))*quad(lambda y: exp(-y**2/(-2*rho**2*sig_y**2 + 2*sig_y**2))*exp(2*y0*y/(-2*rho**2*sig_y**2 + 2*sig_y**2))*exp(-2*rho*x0*y/(-2*rho**2*sig_x*sig_y + 2*sig_x*sig_y))*exp(2*rho*x*y/(-2*rho**2*sig_x*sig_y + 2*sig_x*sig_y)), -inf, inf)[0]/(sig_x*sig_y*pi*sqrt(-(rho - 1)*(rho + 1)))
> /usr/lib/python3/dist-packages/scipy/integrate/_quadpack_py.py:464: in quad
>     retval = _quad(func, a, b, args, full_output, epsabs, epsrel, limit,
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> 
> func = <function _lambdifygenerated.<locals>.<lambda> at 0x7ff39297bf60>
> a = -inf, b = inf, args = (), full_output = 0, epsabs = 1.49e-08
> epsrel = 1.49e-08, limit = 50, points = None
> 
>     def _quad(func,a,b,args,full_output,epsabs,epsrel,limit,points):
>         infbounds = 0
>         if (b != np.inf and a != -np.inf):
>             pass   # standard integration
>         elif (b == np.inf and a != -np.inf):
>             infbounds = 1
>             bound = a
>         elif (b == np.inf and a == -np.inf):
>             infbounds = 2
>             bound = 0     # ignored
>         elif (b != np.inf and a == -np.inf):
>             infbounds = -1
>             bound = b
>         else:
>             raise RuntimeError("Infinity comparisons don't work for you.")
>     
>         if points is None:
>             if infbounds == 0:
>                 return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
>             else:
> >               return _quadpack._qagie(func, bound, infbounds, args, full_output,
>                                         epsabs, epsrel, limit)
> E               TypeError: only length-1 arrays can be converted to Python scalars
> 
> /usr/lib/python3/dist-packages/scipy/integrate/_quadpack_py.py:613: TypeError
> =============================== warnings summary ===============================
> symfit/core/printing.py:13
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build/symfit/core/printing.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
>     import pkg_resources
> 
> tests/test_auto_fit.py: 3 warnings
> tests/test_constrained.py: 14 warnings
> tests/test_finite_difference.py: 1 warning
> tests/test_fit_result.py: 5 warnings
> tests/test_general.py: 16 warnings
> tests/test_minimizers.py: 2 warnings
> tests/test_objectives.py: 1 warning
> tests/test_ode.py: 1 warning
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build/symfit/core/fit.py:278: DeprecationWarning: `product` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `prod` instead.
>     cov_matrix = self._covariance_matrix(best_fit_params,
> 
> tests/test_auto_fit.py: 2 warnings
> tests/test_constrained.py: 13 warnings
> tests/test_finite_difference.py: 2 warnings
> tests/test_fit_result.py: 1 warning
> tests/test_general.py: 12 warnings
> tests/test_global_opt.py: 3 warnings
> tests/test_ode.py: 7 warnings
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build/symfit/core/fit.py:301: DeprecationWarning: `product` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `prod` instead.
>     cov_matrix = self._covariance_matrix(best_fit_params,
> 
> tests/test_constrained.py: 196 warnings
>   /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build/tests/test_constrained.py:766: DeprecationWarning: 'scipy.integrate.simps' is deprecated in favour of 'scipy.integrate.simpson' and will be removed in SciPy 1.14.0
>     {Y: lambda x, y: simps(y, x) - 1},  # Integrate using simps
> 
> tests/test_general.py::test_likelihood_fitting_exponential
>   /usr/lib/python3/dist-packages/_pytest/python.py:159: DeprecationWarning: `product` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `prod` instead.
>     result = testfunction(**testargs)
> 
> -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
> =========================== short test summary info ============================
> FAILED tests/test_general.py::test_likelihood_fitting_bivariate_gaussian - Ty...
> ====== 1 failed, 119 passed, 3 skipped, 281 warnings in 117.77s (0:01:57) ======
> E: pybuild pybuild:389: test: plugin distutils failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12/build; python3.12 -m pytest tests
> dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.12 returned exit code 13


The full build log is available from:
http://qa-logs.debian.net/2024/08/09/symfit_0.5.6-3_unstable.log

All bugs filed during this archive rebuild are listed at:
https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=ftbfs-20240809;users=lucas@debian.org
or:
https://udd.debian.org/bugs/?release=na&merged=ign&fnewerval=7&flastmodval=7&fusertag=only&fusertagtag=ftbfs-20240809&fusertaguser=lucas@debian.org&allbugs=1&cseverity=1&ctags=1&caffected=1#results

A list of current common problems and possible solutions is available at
http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute!

If you reassign this bug to another package, please mark it as 'affects'-ing
this package. See https://www.debian.org/Bugs/server-control#affects

If you fail to reproduce this, please provide a build log and diff it with mine
so that we can identify if something relevant changed in the meantime.



More information about the debian-science-maintainers mailing list