Bug#1026349: sasview: autopkgtest needs update for new version of numpy: module 'numpy' has no attribute 'asscalar'

Paul Gevers elbrus at debian.org
Sun Dec 18 20:21:11 GMT 2022


Source: sasview
Version: 5.0.5-3
Severity: serious
X-Debbugs-CC: numpy at packages.debian.org
Tags: sid bookworm
User: debian-ci at lists.debian.org
Usertags: needs-update
Control: affects -1 src:numpy

Dear maintainer(s),

With a recent upload of numpy the autopkgtest of sasview fails in 
testing when that autopkgtest is run with the binary packages of numpy 
from unstable. It passes when run with only packages from testing. In 
tabular form:

                        pass            fail
numpy                  from testing    1:1.23.5-2
sasview                from testing    5.0.5-3
all others             from testing    from testing

I copied some of the output at the bottom of this report.

Currently this regression is blocking the migration of numpy to testing 
[1]. Of course, numpy shouldn't just break your autopkgtest (or even 
worse, your package), but it seems to me that the change in numpy was 
intended and your package needs to update to the new situation.

If this is a real problem in your package (and not only in your 
autopkgtest), the right binary package(s) from numpy should really add a 
versioned Breaks on the unfixed version of (one of your) package(s). 
Note: the Breaks is nice even if the issue is only in the autopkgtest as 
it helps the migration software to figure out the right versions to 
combine in the tests.

More information about this bug and the reason for filing it can be found on
https://wiki.debian.org/ContinuousIntegration/RegressionEmailInformation

Paul

[1] https://qa.debian.org/excuses.php?package=numpy

https://ci.debian.net/data/autopkgtest/testing/amd64/s/sasview/29465796/log.gz

=================================== FAILURES 
===================================
__________________________ TestBasicComponent.test_iq 
__________________________

self = <test.pr_inversion.utest_invertor.TestBasicComponent 
testMethod=test_iq>

     def test_iq(self):
         """
             Test iq calculation
         """
         q = 0.11
         v1 = 8.0*math.pi**2/q * self.invertor.d_max 
*math.sin(q*self.invertor.d_max)
         v1 /= ( math.pi**2 - (q*self.invertor.d_max)**2.0 )
             pars = numpy.ones(1)
>       self.assertAlmostEqual(self.invertor.iq(pars, q), v1, 2)

test/pr_inversion/utest_invertor.py:171: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/sas/sascalc/pr/invertor.py:315: in iq
     return Pinvertor.iq(self, out, q) + self.background
/usr/lib/python3/dist-packages/sas/sascalc/pr/p_invertor.py:339: in iq
     return np.asscalar(iq_val)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _
attr = 'asscalar'

     def __getattr__(attr):
         # Warn for expired attributes, and return a dummy function
         # that always raises an exception.
         try:
             msg = __expired_functions__[attr]
         except KeyError:
             pass
         else:
             warnings.warn(msg, DeprecationWarning, stacklevel=2)
                 def _expired(*args, **kwds):
                 raise RuntimeError(msg)
                 return _expired
             # Emit warnings for deprecated attributes
         try:
             val, msg = __deprecated_attrs__[attr]
         except KeyError:
             pass
         else:
             warnings.warn(msg, DeprecationWarning, stacklevel=2)
             return val
             # Importing Tester requires importing all of UnitTest which 
is not a
         # cheap import Since it is mainly used in test suits, we lazy 
import it
         # here to save on the order of 10 ms of import time for most users
         #
         # The previous way Tester was imported also had a side effect 
of adding
         # the full `numpy.testing` namespace
         if attr == 'testing':
             import numpy.testing as testing
             return testing
         elif attr == 'Tester':
             from .testing import Tester
             return Tester
     >       raise AttributeError("module {!r} has no attribute "
                              "{!r}".format(__name__, attr))
E       AttributeError: module 'numpy' has no attribute 'asscalar'

/usr/lib/python3/dist-packages/numpy/__init__.py:311: AttributeError
__________________________ TestBasicComponent.test_pr 
__________________________

self = <test.pr_inversion.utest_invertor.TestBasicComponent 
testMethod=test_pr>

     def test_pr(self):
         """
             Test pr calculation
         """
         r = 10.0
         v1 = 2.0*r*math.sin(math.pi*r/self.invertor.d_max)
         pars = numpy.ones(1)
>       self.assertAlmostEqual(self.invertor.pr(pars, r), v1, 2)

test/pr_inversion/utest_invertor.py:180: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/sas/sascalc/pr/p_invertor.py:380: in pr
     return np.asscalar(pr_val)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _
attr = 'asscalar'

     def __getattr__(attr):
         # Warn for expired attributes, and return a dummy function
         # that always raises an exception.
         try:
             msg = __expired_functions__[attr]
         except KeyError:
             pass
         else:
             warnings.warn(msg, DeprecationWarning, stacklevel=2)
                 def _expired(*args, **kwds):
                 raise RuntimeError(msg)
                 return _expired
             # Emit warnings for deprecated attributes
         try:
             val, msg = __deprecated_attrs__[attr]
         except KeyError:
             pass
         else:
             warnings.warn(msg, DeprecationWarning, stacklevel=2)
             return val
             # Importing Tester requires importing all of UnitTest which 
is not a
         # cheap import Since it is mainly used in test suits, we lazy 
import it
         # here to save on the order of 10 ms of import time for most users
         #
         # The previous way Tester was imported also had a side effect 
of adding
         # the full `numpy.testing` namespace
         if attr == 'testing':
             import numpy.testing as testing
             return testing
         elif attr == 'Tester':
             from .testing import Tester
             return Tester
     >       raise AttributeError("module {!r} has no attribute "
                              "{!r}".format(__name__, attr))
E       AttributeError: module 'numpy' has no attribute 'asscalar'

/usr/lib/python3/dist-packages/numpy/__init__.py:311: AttributeError
_________________________ TestBasicComponent.test_save 
_________________________

self = <test.pr_inversion.utest_invertor.TestBasicComponent 
testMethod=test_save>

     def test_save(self):
         x, y, err = load(find("sphere_80.txt"))
             # Choose the right d_max...
         self.invertor.d_max = 160.0
         # Set a small alpha
         self.invertor.alpha = .0007
         # Set data
         self.invertor.x   = x
         self.invertor.y   = y
         self.invertor.err = err
         # Perform inversion
             out, cov = self.invertor.lstsq(10)
             # Save
         f_name = "test_output.txt"
         self.invertor.to_file(f_name)
             # Load
         self.invertor.from_file(f_name)
         self.assertEqual(self.invertor.d_max, 160.0)
         self.assertEqual(self.invertor.alpha, 0.0007)
         self.assertEqual(self.invertor.chi2, 836.797)
>       self.assertAlmostEqual(self.invertor.pr(self.invertor.out, 10.0), 903.30597721, 4)

test/pr_inversion/utest_invertor.py:436: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3/dist-packages/sas/sascalc/pr/p_invertor.py:380: in pr
     return np.asscalar(pr_val)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _
attr = 'asscalar'

     def __getattr__(attr):
         # Warn for expired attributes, and return a dummy function
         # that always raises an exception.
         try:
             msg = __expired_functions__[attr]
         except KeyError:
             pass
         else:
             warnings.warn(msg, DeprecationWarning, stacklevel=2)
                 def _expired(*args, **kwds):
                 raise RuntimeError(msg)
                 return _expired
             # Emit warnings for deprecated attributes
         try:
             val, msg = __deprecated_attrs__[attr]
         except KeyError:
             pass
         else:
             warnings.warn(msg, DeprecationWarning, stacklevel=2)
             return val
             # Importing Tester requires importing all of UnitTest which 
is not a
         # cheap import Since it is mainly used in test suits, we lazy 
import it
         # here to save on the order of 10 ms of import time for most users
         #
         # The previous way Tester was imported also had a side effect 
of adding
         # the full `numpy.testing` namespace
         if attr == 'testing':
             import numpy.testing as testing
             return testing
         elif attr == 'Tester':
             from .testing import Tester
             return Tester
     >       raise AttributeError("module {!r} has no attribute "
                              "{!r}".format(__name__, attr))
E       AttributeError: module 'numpy' has no attribute 'asscalar'

/usr/lib/python3/dist-packages/numpy/__init__.py:311: AttributeError
=============================== warnings summary 
===============================
test/pr_inversion/utest_invertor.py::TestBasicComponent::test_save
 
/tmp/autopkgtest-lxc.s3tk5hb8/downtmp/autopkgtest_tmp/test/pr_inversion/utest_invertor.py:432: 
ResourceWarning: unclosed file <_io.TextIOWrapper name='test_output.txt' 
mode='r' encoding='UTF-8'>
     self.invertor.from_file(f_name)
   Enable tracemalloc to get traceback where the object was allocated.
   See 
https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings 
for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info 
============================
FAILED test/pr_inversion/utest_invertor.py::TestBasicComponent::test_iq 
- Att...
FAILED test/pr_inversion/utest_invertor.py::TestBasicComponent::test_pr 
- Att...
FAILED 
test/pr_inversion/utest_invertor.py::TestBasicComponent::test_save - A...
=================== 3 failed, 171 passed, 1 warning in 5.68s 
===================
autopkgtest [09:26:45]: test python3-sasview

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/debian-science-maintainers/attachments/20221218/7bee6a59/attachment.sig>


More information about the debian-science-maintainers mailing list