Bug#943786: lmfit-py: failing tests with python3.8
Steve Langasek
steve.langasek at canonical.com
Tue Oct 29 19:49:08 GMT 2019
Source: lmfit-py
Version: 0.9.14-1
Severity: important
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu focal
Dear maintainers,
The lmfit-py package fails to build from source in Ubuntu focal, because
Ubuntu has begun the transition to python3.8 and lmfit-py 0.9.14 is not
source-compatible with python3.8:
[...]
==================================== ERRORS ====================================
_________________ ERROR at setup of test_algebraic_constraints _________________
@pytest.fixture
def minimizer():
"""Return the Minimizer object."""
def residual(pars, x, sigma=None, data=None):
"""Define objective function."""
yg = gaussian(x, pars['amp_g'], pars['cen_g'], pars['wid_g'])
yl = lorentzian(x, pars['amp_l'], pars['cen_l'], pars['wid_l'])
model = yg + yl + pars['line_off'] + x * pars['line_slope']
if data is None:
return model
if sigma is None:
return model - data
return (model-data) / sigma
# generate synthetic data
n = 601
xmin = 0.
xmax = 20.0
x = np.linspace(xmin, xmax, n)
data = (gaussian(x, 21, 8.1, 1.2) + lorentzian(x, 10, 9.6, 2.4) +
np.random.normal(scale=0.23, size=n) + x*0.5)
# create initial Parameters
pars = Parameters()
pars.add(name='amp_g', value=10)
pars.add(name='cen_g', value=9)
pars.add(name='wid_g', value=1)
pars.add(name='amp_tot', value=20)
pars.add(name='amp_l', expr='amp_tot - amp_g')
> pars.add(name='cen_l', expr='1.5+cen_g')
tests/test_algebraic_constraint.py:41:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lmfit/parameter.py:361: in add
self.__setitem__(name, Parameter(value=value, name=name, vary=vary,
lmfit/parameter.py:132: in __setitem__
self._asteval.symtable[key] = par.value
lmfit/parameter.py:823: in value
return self._getval()
lmfit/parameter.py:805: in _getval
check_ast_errors(self._expr_eval)
lmfit/parameter.py:25: in check_ast_errors
expr_eval.raise_exception(None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <asteval.asteval.Interpreter object at 0x7fe24279e190>, node = None
exc = <class 'NotImplementedError'>, msg = ''
expr = <_ast.Module object at 0x7fe2428fa4f0>, lineno = None
def raise_exception(self, node, exc=None, msg='', expr=None,
lineno=None):
"""Add an exception."""
if self.error is None:
self.error = []
if expr is None:
expr = self.expr
if len(self.error) > 0 and not isinstance(node, ast.Module):
msg = '%s' % msg
err = ExceptionHolder(node, exc=exc, msg=msg, expr=expr, lineno=lineno)
self._interrupt = ast.Break()
self.error.append(err)
if self.error_msg is None:
self.error_msg = "%s in expr='%s'" % (msg, self.expr)
elif len(msg) > 0:
self.error_msg = "%s\n %s" % (self.error_msg, msg)
if exc is None:
try:
exc = self.error[0].exc
except:
exc = RuntimeError
> raise exc(self.error_msg)
E NotImplementedError: 'Constant' not supported in expr='<_ast.Module object at 0x7fe2428fa4f0>'
/usr/lib/python3/dist-packages/asteval/asteval.py:248: NotImplementedError
---------------------------- Captured stderr setup -----------------------------
NotImplementedError
<_ast.Module object at 0x7fe2428fa4f0>
'Constant' not supported
[...]
(https://launchpad.net/ubuntu/+source/lmfit-py/0.9.14-1/+build/17990659)
Debian has not yet started the transition to python3.8 - the version of
python3-defaults that adds python3.8 as supported is currently in
experimental - but this will eventually become a serious bug in Debian as
well once that transition begins.
For the moment I have worked around the failure in Ubuntu by changing the
packaging to test only against the current version of python3 and not
against all supported versions, but this is a very short-term fix given that
python3.8 will become the default in the next 6 months.
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer https://www.debian.org/
slangasek at ubuntu.com vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20191029/3635b826/attachment.sig>
More information about the debian-science-maintainers
mailing list