Skip to content

DEP: Deprecate numpy.linalg.lapack_lite module - #32015

Merged
mattip merged 4 commits into
numpy:mainfrom
prathamhole14:dep_lapack_lite-
Jul 24, 2026
Merged

mattip merged 4 commits into
numpy:mainfrom
prathamhole14:dep_lapack_lite-

Conversation

@prathamhole14

Copy link
Copy Markdown
Member

PR summary

As titled, based on: #31928 (comment)

Note:
If a user simply import numpy.linalg.lapack_lite it will not give warning, it will warn only if used in test (run via pytest) or with -W flag with python3/python.

CC: @seberg @mattip

AI Disclosure

To write release note - it LGTM but someone please check it again. And to find the best way to write test for module dep.

@jorenham jorenham left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice if we could slap some @typing_extensions.deprecated onto the functions in https://github.com/numpy/numpy/blob/cda64f0cf4584aa9e735d46ba27874296501333a/numpy/linalg/lapack_lite.pyii . That way static type-checkers will warn you if you use it at type-check-time.

@prathamhole14

prathamhole14 commented Jul 16, 2026 •

Copy link
Copy Markdown
Member Author

Thanks for pointing that out I was unaware of @typing_extensions.deprecated.

@jorenham jorenham left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stub changes look good; thanks 👍

Comment thread numpy/linalg/lapack_lite.pyi Resolved
@mattip

mattip commented Jul 16, 2026

Copy link
Copy Markdown
Member

If there are people using this module for real code, then the whole premise of this issue and PR are less correct ( i.e. wrong) and we shouldn’t deprecate it.

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecating LGTM, this isn't meant to be public. One test should be removed before merging.

Comment thread numpy/linalg/tests/test_deprecations.py Resolved

@ngoldbaum ngoldbaum left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I asked an AI model to search for open-source uses of this module and it found two cases that aren't covered by the advice here:

  • astra-toolbox/astra-toolbox: imports numpy.linalg.lapack_lite from C++ purely as a RTLD_DEEPBIND side-effect to stop MATLAB's MKL from clashing with numpy's LAPACK. It calls no routine at all.
  • BLAS/Fortran introspection recipes — e.g. simomarsili/ndd uses numpy.linalg.lapack_lite.__file__ to locate the .so and run ldd on it; the _ilp64 attribute is used elsewhere to detect 64-bit BLAS.

The former could use numpy.linalg._umath_linalg instead. I'm not sure if we need to explicitly document that though because it's an unusual thing to do. Maybe one of us could send in a PR to astra-toolbox and reference this PR?

The latter could use np.show_config() instead. We should probably explicitly suggest np.show_confg() in the deprecation warning for people who are using the module for introspection.

@mattip
mattip merged commit c09ba3a into numpy:main Jul 24, 2026
93 checks passed
@mattip

mattip commented Jul 24, 2026

Copy link
Copy Markdown
Member

Thanks @prathamhole14

@prathamhole14
prathamhole14 deleted the dep_lapack_lite- branch July 24, 2026 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants