Opened 4 years ago

Last modified 3 years ago

#27000 closed enhancement

Upgrade NumPy to 1.16 — at Version 13

Reported by: thansen Owned by:
Priority: major Milestone: sage-8.7
Component: packages: standard Keywords: upgrade, numpy
Cc: arojas, fbissey, slelievre, thansen, tmonteil Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #26288 Stopgaps:

Status badges

Description (last modified by jdemeyer)

Numpy 1.16.0 was released on 2019-01-14.

From the release announcement:

On behalf of the NumPy team I'm pleased to announce the release of NumPy 1.16.0. This is the last NumPy release to support Python 2.7 and will be maintained as a long term release with bug fixes until 2020. This release has seen a lot of refactoring and features many bug fixes, improved code organization, and better cross platform compatibility. Not all of these improvements will be visible to users, but they should help make maintenance easier going forward. Highlights are

  • Experimental support for overriding numpy functions in downstream projects.
  • The matmul function is now a ufunc and can be overridden using array_ufunc.
  • Improved support for the ARM, POWER, and SPARC architectures.
  • Improved support for AIX and PyPy.
  • Improved interoperation with ctypes.
  • Improved support for PEP 3118.

The supported Python versions are 2.7 and 3.5-3.7, support for 3.4 has been dropped. The wheels on PyPI are linked with OpenBLAS v0.3.4+, which should fix the known threading issues found in previous OpenBLAS versions. Downstream developers building this release should use Cython >= 0.29.2 and, if linking OpenBLAS, OpenBLAS > v0.3.4.

So this depends on the upgrade to OpenBlas? 0.3.5 (from 0.3.3) in #27020, and on the upgrade to Cython 0.29.2 in #27058.

Debian developers warn us that NumPy 1.16.0rc1 in Debian leads to some deprecation warnings:

DeprecationWarning: np.asscalar(a) is deprecated since NumPy v1.16, use a.item() instead

These are fixed by adding a patch to matplotlib in #26288

It would be nice if SageMath could update the package soon after the NumPy 1.16 release.

Change History (13)

comment:1 Changed 4 years ago by fbissey

  • Cc fbissey added

comment:2 Changed 3 years ago by tmonteil

  • Cc tmonteil added

comment:3 Changed 3 years ago by slelievre

  • Cc arojas slelievre added
  • Description modified (diff)
  • Keywords upgrade numpy added

comment:4 Changed 3 years ago by slelievre

  • Description modified (diff)

comment:5 Changed 3 years ago by embray

It seems most, if not all of these DeprecationWarnings are actually coming via matplotlib. I don't even see any explict np.asscalar() calls in the Sage sources.

comment:6 Changed 3 years ago by embray

comment:7 Changed 3 years ago by arojas

I'm getting this on Arch after updating to 1.16.0

sage -t /usr/lib/python2.7/site-packages/sage/misc/
File "/usr/lib/python2.7/site-packages/sage/misc/", line 134, in sage.misc.inline_fortran._import_module_from_path._import_module_from_path_impl
Failed example:
    fortran(code, globals())
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/sage/doctest/", line 671, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib/python2.7/site-packages/sage/doctest/", line 1086, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.misc.inline_fortran._import_module_from_path._import_module_from_path_impl[1]>", line 1, in <module>
        fortran(code, globals())
      File "sage/misc/lazy_import.pyx", line 354, in sage.misc.lazy_import.LazyImport.__call__ (build/cythonized/sage/misc/lazy_import.c:3684)
        return self.get_object()(*args, **kwds)
      File "/usr/lib/python2.7/site-packages/sage/misc/", line 96, in __call__
        return self.eval(*args, **kwds)
      File "/usr/lib/python2.7/site-packages/sage/misc/", line 191, in eval
        with open(log) as fobj:
    IOError: [Errno 2] No such file or directory: 'fortran_module.log'

comment:8 Changed 3 years ago by slelievre

  • Cc thansen added
  • Dependencies set to #27020, #27058
  • Description modified (diff)
  • Type changed from defect to enhancement

Editing ticket description now that NumPy 1.16.0 is released.

The release announcement for NumPy 1.16.0 warns:

Downstream developers building this release should use Cython >= 0.29.2 and, if linking OpenBLAS, OpenBLAS > v0.3.4.

So this depends on the upgrade to OpenBLAS 0.3.5 (from 0.3.3) in #27020, and on the upgrade to Cython 0.29.2 in #27058.

Last edited 3 years ago by slelievre (previous) (diff)

comment:9 Changed 3 years ago by embray

I also get some problems with inline_fortran on Numpy 1.16 (this has been affecting the Debian port). Haven't looked into it yet.

comment:10 Changed 3 years ago by embray

The inline_fortran problem appears to be caused by a backwards-incompatibility introduced by

This interface previously was documented as calling f2py through a shell, which meant it was possible to pass constructs like shell redirections in the extra_args argument. So that PR should have passed shell=True to subprocess.check_output in order to keep that functionality, but it did not (that, or formally deprecate it and also allow a way to capture standard I/O).

comment:11 Changed 3 years ago by embray

  • Dependencies changed from #27020, #27058 to #27020, #27058, #27061

#27061 offers a fix to the problem with sage.misc.inline_fortran.

comment:12 Changed 3 years ago by embray

  • Milestone changed from sage-8.6 to sage-8.7

Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist.

comment:13 Changed 3 years ago by jdemeyer

  • Dependencies changed from #27020, #27058, #27061 to #26288
  • Description modified (diff)
Note: See TracTickets for help on using tickets.