Answers for LLM inference engineers

ImportError: cannot import name 'triu' from 'scipy.linalg' (or 'simps', 'imread', any name): which SciPy removed it and what to use

SciPy 1.13.0 (2024-04-02) removed scipy.linalg.triu, tril and tri (use numpy.triu), which breaks gensim 4.3.2 and earlier; 1.14.0 (2024-06-24) removed scipy.integrate.simps, trapz, cumtrapz (use simpson, trapezoid, cumulative_trapezoid) and the sparse .A (use .toarray()); 1.3.0 removed scipy.misc.imread and imresize (use imageio or Pillow). If the error comes from a library you did not write, upgrade the library or pin SciPy below the release that removed the name. Paste the error below for the release-by-release answer.

Published 2026-11-25 · 17 SciPy releases installed and run, 1.3.3 to 1.18.1 (50,337 name lookups) · how

Examples:

Runs in your browser on the data in this page (scipy_names.json); nothing you paste is sent anywhere.

Which release removed it, and what replaces it?

117 public names of SciPy's submodules and sparse matrix classes that one release has and a later one does not, plus 577 NumPy names the scipy namespace used to re-export (539 of them removed in 1.12.0; the lookup answers for each). "Instead" is SciPy's own deprecation text from the last release that had the name (75 of 117); for 19 more it names the module that still has the same name in 1.18.1.

NameRemoved inInstead
scipy.misc.bytescale1.3.0`bytescale` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
scipy.misc.comb1.3.0Importing `comb` from scipy.misc is deprecated in scipy 1.0.0. Use `scipy.special.comb` instead.
scipy.misc.factorial1.3.0Importing `factorial` from scipy.misc is deprecated in scipy 1.0.0. Use `scipy.special.factorial` instead.
scipy.misc.factorial21.3.0Importing `factorial2` from scipy.misc is deprecated in scipy 1.0.0. Use `scipy.special.factorial2` instead.
scipy.misc.factorialk1.3.0Importing `factorialk` from scipy.misc is deprecated in scipy 1.0.0. Use `scipy.special.factorialk` instead.
scipy.misc.fromimage1.3.0`fromimage` is deprecated in SciPy 1.0.0. and will be removed in 1.2.0. Use ``np.asarray(im)`` instead.
scipy.misc.imfilter1.3.0`imfilter` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use Pillow filtering functionality directly.
scipy.misc.imread1.3.0`imread` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``imageio.imread`` instead.
scipy.misc.imresize1.3.0`imresize` is deprecated in SciPy 1.0.0, and will be removed in 1.3.0. Use Pillow instead: ``numpy.array(Image.fromarray(arr).resize())``.
scipy.misc.imrotate1.3.0`imrotate` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``skimage.transform.rotate`` instead.
scipy.misc.imsave1.3.0`imsave` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``imageio.imwrite`` instead.
scipy.misc.imshow1.3.0`imshow` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use ``matplotlib.pyplot.imshow`` instead.
scipy.misc.logsumexp1.3.0Importing `logsumexp` from scipy.misc is deprecated in scipy 1.0.0. Use `scipy.special.logsumexp` instead.
scipy.misc.toimage1.3.0`toimage` is deprecated in SciPy 1.0.0, and will be removed in 1.2.0. Use Pillow's ``Image.fromarray`` directly instead.
scipy.special.bessel_diff_formula1.4.0
scipy.special.hyp1f21.4.0hyp1f2 is deprecated in SciPy 1.2
scipy.special.hyp2f01.4.0hyp2f0 is deprecated in SciPy 1.2
scipy.special.hyp3f01.4.0hyp3f0 is deprecated in SciPy 1.2
scipy.linalg.linalg_version1.5.0
scipy.odr.add_newdocs1.5.0
scipy.signal.slepian1.6.0slepian is deprecated and will be removed in a future version, use dpss instead
scipy.signal.windows.slepian1.6.0slepian is deprecated and will be removed in a future version, use dpss instead
scipy.stats.frechet_l1.6.0The distribution `frechet_l` is a synonym for `weibull_max`; this historical usage is deprecated because of possible confusion with the (quite different) Frechet distribution. To preserve the existing behavior of the program, use `scipy.stats.weibull_max`. For the Frechet distribution (i.e. the Type II extreme value distribution), use `scipy.stats.invweibull`.
scipy.stats.frechet_r1.6.0The distribution `frechet_r` is a synonym for `weibull_min`; this historical usage is deprecated because of possible confusion with the (quite different) Frechet distribution. To preserve the existing behavior of the program, use `scipy.stats.weibull_min`. For the Frechet distribution (i.e. the Type II extreme value distribution), use `scipy.stats.invweibull`.
scipy.io.byteordercodes1.8.0
scipy.signal.sigtools1.8.0
scipy.sparse.linalg.arpack1.8.0
scipy.sparse.linalg.iterative1.8.0
scipy.sparse.linalg.linsolve1.8.0
scipy.sparse.linalg.utils1.8.0
scipy.spatial.distance.wminkowski1.8.0scipy.distance.wminkowski is deprecated and will be removed in SciPy 1.8.0, use scipy.distance.minkowski instead.
scipy.integrate.quad_explain1.9.0
scipy.linalg.pinv21.9.0scipy.linalg.pinv2 is deprecated since SciPy 1.7.0, use scipy.linalg.pinv instead
scipy.signal.hanning1.9.0
scipy.signal.windows.hanning1.9.0
scipy.spatial.distance.matching1.9.0spatial.distance.matching is deprecated in scipy 1.0.0; use spatial.distance.hamming instead.
scipy.stats.BootstrapDegenerateDistributionWarning1.9.0
scipy.stats.F_onewayBadInputSizesWarning1.9.0
scipy.stats.F_onewayConstantInputWarning1.9.0
scipy.stats.itemfreq1.9.0`itemfreq` is deprecated and will be removed in a future version. Use instead `np.unique(..., return_counts=True)`
scipy.stats.median_absolute_deviation1.9.0
scipy.stats.PearsonRConstantInputWarning1.9.0
scipy.stats.PearsonRNearConstantInputWarning1.9.0
scipy.stats.SpearmanRConstantInputWarning1.9.0
scipy.stats.NumericalInverseHermite1.10.0NumericalInverseHermite has been deprecated from `scipy.stats` and will be removed in SciPy 1.10.0. To use `NumericalInverseHermite`, import/use it from `scipy.stats.sampling` module instead. i.e. `from scipy.stats.sampling import NumericalInverseHermite`
scipy.spatial.distance.kulsinski1.11.1Kulsinski has been deprecated from scipy.spatial.distance in SciPy 1.9.0 and it will be removed in SciPy 1.11.0. It is superseded by scipy.spatial.distance.kulczynski1.
scipy.stats.gilbrat1.11.1`gilbrat` is deprecated, use `gibrat` instead!
scipy.stats.binom_test1.12.0'binom_test' is deprecated in favour of 'binomtest' from version 1.7.0 and will be removed in Scipy 1.12.0.
scipy.stats.statlib1.12.0scipy.stats.statlib is deprecated and has no attribute
scipy.linalg.flinalg1.13.0
scipy.linalg.tri1.13.0'tri'/'tril/'triu' are deprecated as of SciPy 1.11.0 and will be removed in v1.13.0. Please use numpy.(tri/tril/triu) instead.
scipy.linalg.tril1.13.0'tri'/'tril/'triu' are deprecated as of SciPy 1.11.0 and will be removed in v1.13.0. Please use numpy.(tri/tril/triu) instead.
scipy.linalg.triu1.13.0'tri'/'tril/'triu' are deprecated as of SciPy 1.11.0 and will be removed in v1.13.0. Please use numpy.(tri/tril/triu) instead.
scipy.signal.barthann1.13.0From scipy.signal.windows import barthann (still there in 1.18.1).
scipy.signal.bartlett1.13.0From scipy.signal.windows import bartlett (still there in 1.18.1).
scipy.signal.blackman1.13.0From scipy.signal.windows import blackman (still there in 1.18.1).
scipy.signal.blackmanharris1.13.0From scipy.signal.windows import blackmanharris (still there in 1.18.1).
scipy.signal.bohman1.13.0From scipy.signal.windows import bohman (still there in 1.18.1).
scipy.signal.boxcar1.13.0From scipy.signal.windows import boxcar (still there in 1.18.1).
scipy.signal.bspline1.13.0`scipy.signal.bspline` is deprecated in SciPy 1.11 and will be removed in SciPy 1.13. The exact equivalent (for a float array `x`) is >>> from scipy.interpolate import BSpline >>> knots = np.arange(-(n+1)/2, (n+3)/2) >>> out = BSpline.basis_element(knots)(x) >>> out[(x < knots[0]) | (x > knots[-1])] = 0.0
scipy.signal.chebwin1.13.0From scipy.signal.windows import chebwin (still there in 1.18.1).
scipy.signal.cosine1.13.0From scipy.signal.windows import cosine (still there in 1.18.1).
scipy.signal.cubic1.13.0`scipy.signal.cubic` is deprecated in SciPy 1.11 and will be removed in SciPy 1.13. The exact equivalent (for a float array `x`) is >>> from scipy.interpolate import BSpline >>> out = BSpline.basis_element([-2, -1, 0, 1, 2])(x) >>> out[(x < -2 | (x > 2)] = 0.0
scipy.signal.exponential1.13.0From scipy.odr import exponential (still there in 1.18.1).
scipy.signal.flattop1.13.0From scipy.signal.windows import flattop (still there in 1.18.1).
scipy.signal.gaussian1.13.0From scipy.signal.windows import gaussian (still there in 1.18.1).
scipy.signal.general_gaussian1.13.0From scipy.signal.windows import general_gaussian (still there in 1.18.1).
scipy.signal.hamming1.13.0From scipy.signal.windows import hamming (still there in 1.18.1).
scipy.signal.hann1.13.0From scipy.signal.windows import hann (still there in 1.18.1).
scipy.signal.impulse21.13.0impulse2 is deprecated and will be removed from scipy 1.13. Use the feature-equivalent impulse function.
scipy.signal.kaiser1.13.0From scipy.signal.windows import kaiser (still there in 1.18.1).
scipy.signal.lsim21.13.0lsim2 is deprecated and will be removed from scipy 1.13. Use the feature-equivalent lsim function.
scipy.signal.nuttall1.13.0From scipy.signal.windows import nuttall (still there in 1.18.1).
scipy.signal.parzen1.13.0From scipy.signal.windows import parzen (still there in 1.18.1).
scipy.signal.quadratic1.13.0`scipy.signal.quadratic` is deprecated in SciPy 1.11 and will be removed in SciPy 1.13. The exact equivalent (for a float array `x`) is >>> from scipy.interpolate import BSpline >>> out = BSpline.basis_element([-1.5, -0.5, 0.5, 1.5])(x) >>> out[(x < -1.5 | (x > 1.5)] = 0.0
scipy.signal.step21.13.0step2 is deprecated and will be removed from scipy 1.13. Use the feature-equivalent step function.
scipy.signal.triang1.13.0From scipy.signal.windows import triang (still there in 1.18.1).
scipy.signal.tukey1.13.0From scipy.signal.windows import tukey (still there in 1.18.1).
scipy.integrate.cumtrapz1.14.0'scipy.integrate.cumtrapz' is deprecated in favour of 'scipy.integrate.cumulative_trapezoid' and will be removed in SciPy 1.14.0
scipy.integrate.simps1.14.0'scipy.integrate.simps' is deprecated in favour of 'scipy.integrate.simpson' and will be removed in SciPy 1.14.0
scipy.integrate.trapz1.14.0'scipy.integrate.trapz' is deprecated in favour of 'scipy.integrate.trapezoid' and will be removed in SciPy 1.14.0
scipy.interpolate.dfitpack1.14.0
scipy.sparse.coo_matrix.A1.14.0`.A` is deprecated and will be removed in v1.14.0. Use `.toarray()` instead.
scipy.sparse.coo_matrix.H1.14.0`.H` is deprecated and will be removed in v1.14.0. Please use `.T.conjugate()` instead.
scipy.sparse.csr_matrix.A1.14.0`.A` is deprecated and will be removed in v1.14.0. Use `.toarray()` instead.
scipy.sparse.csr_matrix.H1.14.0`.H` is deprecated and will be removed in v1.14.0. Please use `.T.conjugate()` instead.
scipy.sparse.lil_matrix.A1.14.0`.A` is deprecated and will be removed in v1.14.0. Use `.toarray()` instead.
scipy.sparse.lil_matrix.H1.14.0`.H` is deprecated and will be removed in v1.14.0. Please use `.T.conjugate()` instead.
scipy.integrate.AccuracyWarning1.15.0
scipy.integrate.quadrature1.15.0`scipy.integrate.quadrature` is deprecated as of SciPy 1.12.0and will be removed in SciPy 1.15.0. Please use`scipy.integrate.quad` instead.
scipy.integrate.romberg1.15.0`scipy.integrate.romberg` is deprecated as of SciPy 1.12.0and will be removed in SciPy 1.15.0. Please use`scipy.integrate.quad` instead.
scipy.misc.ascent1.15.0scipy.misc.ascent has been deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. Dataset methods have moved into the scipy.datasets module. Use scipy.datasets.ascent instead.
scipy.misc.central_diff_weights1.15.0scipy.misc.central_diff_weights is deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. You may consider using findiff: https://github.com/maroba/findiff or numdifftools: https://github.com/pbrod/numdifftools
scipy.misc.derivative1.15.0scipy.misc.derivative is deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. You may consider using findiff: https://github.com/maroba/findiff or numdifftools: https://github.com/pbrod/numdifftools
scipy.misc.electrocardiogram1.15.0scipy.misc.electrocardiogram has been deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. Dataset methods have moved into the scipy.datasets module. Use scipy.datasets.electrocardiogram instead.
scipy.misc.face1.15.0scipy.misc.face has been deprecated in SciPy v1.10.0; and will be completely removed in SciPy v1.12.0. Dataset methods have moved into the scipy.datasets module. Use scipy.datasets.face instead.
scipy.signal.cascade1.15.0scipy.signal.cascade is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.signal.cmplx_sort1.15.0cmplx_sort was deprecated in SciPy 1.12 and will be removed in SciPy 1.15. The exact equivalent for a numpy array argument is >>> def cmplx_sort(p): ... idx = np.argsort(abs(p)) ... return np.take(p, idx, 0), idx
scipy.signal.cwt1.15.0scipy.signal.cwt is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.signal.daub1.15.0scipy.signal.daub is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.signal.morlet1.15.0scipy.signal.morlet is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.signal.morlet21.15.0scipy.signal.morlet2 is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.signal.qmf1.15.0scipy.signal.qmf is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.signal.ricker1.15.0scipy.signal.ricker is deprecated in SciPy 1.12 and will be removed in SciPy 1.15. We recommend using PyWavelets instead.
scipy.special.btdtr1.15.0This function was deprecated in SciPy 1.12.0, and will be removed in SciPy 1.14.0. Use scipy.special.btdtr instead.
scipy.special.btdtri1.15.0This function was deprecated in SciPy 1.12.0, and will be removed in SciPy 1.14.0. Use scipy.special.btdtri instead.
scipy.stats.rvs_ratio_uniforms1.15.0Please use `RatioUniforms` from the `scipy.stats.sampling` namespace. The `scipy.stats.rvs_ratio_uniforms` namespace is deprecated and will be removed in SciPy 1.15.0
scipy.stats.sampling1.15.0Please use `RatioUniforms` from the `scipy.stats.sampling` namespace. The `scipy.stats.rvs_ratio_uniforms` namespace is deprecated and will be removed in SciPy 1.15.0
scipy.stats.trapz1.16.0`trapz` is deprecated in favour of `trapezoid` and will be removed in SciPy 1.16.0.
scipy.linalg.kron1.17.0`kron` has been deprecated in favour of `numpy.kron` in SciPy 1.15.0 and will be removed in SciPy 1.17.0.
scipy.spatial.distance.kulczynski11.17.0The kulczynski1 metric is deprecated since SciPy 1.15.0 and will be removed in SciPy 1.17.0. Replace usage of 'kulczynski1(u, v)' with '1/jaccard(u, v) - 1'.
scipy.spatial.distance.sokalmichener1.17.0The sokalmichener metric is deprecated since SciPy 1.15.0 and will be removed in SciPy 1.17.0. Replace usage of 'sokalmichener(u, v)' with 'rogerstanimoto(u, v)'.
scipy.special.clpmn1.17.0`scipy.special.clpmn` is deprecated as of SciPy 1.15.0 and will be removed in SciPy 1.17.0.
scipy.special.lpmn1.17.0`scipy.special.lpmn` is deprecated as of SciPy 1.15.0 and will be removed in SciPy 1.17.0.
scipy.special.lpn1.17.0`scipy.special.lpn` is deprecated as of SciPy 1.15.0 and will be removed in SciPy 1.17.0.
scipy.special.sph_harm1.17.0
scipy.stats.find_repeats1.17.0`scipy.stats.find_repeats` is deprecated as of SciPy 1.15.0 and will be removed in SciPy 1.17.0. Please use `numpy.unique`/`numpy.unique_counts` instead.

How was this measured?

Each of 17 SciPy releases (the first of every minor from 1.3.3, plus the latest) was installed from PyPI in its own environment, the public names of scipy, 27 submodules and the sparse matrix classes were listed with dir() and __all__, and getattr was run for the union of all names in every release. Releases: 1.3.3 (Python 3.8, NumPy 1.17.5), 1.4.0 (Python 3.8, NumPy 1.18.5), 1.5.0 (Python 3.8, NumPy 1.19.5), 1.6.0 (Python 3.9, NumPy 1.19.5), 1.7.0 (Python 3.9, NumPy 1.21.6), 1.8.0 (Python 3.10, NumPy 1.22.4), 1.9.0 (Python 3.10, NumPy 1.23.5), 1.10.0 (Python 3.11, NumPy 1.24.4), 1.11.1 (Python 3.11, NumPy 1.25.2), 1.12.0 (Python 3.12, NumPy 1.26.4), 1.13.0 (Python 3.12, NumPy 1.26.4), 1.14.0 (Python 3.12, NumPy 2.0.2), 1.15.0 (Python 3.12, NumPy 2.2.6), 1.16.0 (Python 3.12, NumPy 2.5.5), 1.17.0 (Python 3.12, NumPy 2.5.5), 1.18.0 (Python 3.12, NumPy 2.5.5), 1.18.1 (Python 3.12, NumPy 2.5.5). A name counts when it is in the module's __all__ (or the module has none), so modules a file merely imported (np, warnings) are left out. The replacement text is read from the installed source of the last release that had the name: the strings of its deprecation decorator or warnings.warn call, or another deprecation string in SciPy that names it. The scipy.misc image functions and re-exports removed in 1.3.0 were read from the source at the v1.2.0 and v1.3.0 tags. scipy.fft did not exist in 1.3.3.

Patch releases were not read: a name removed in x.y.1 shows at the next minor.

Questions

How do I fix "cannot import name 'triu' from 'scipy.linalg'" (gensim)?

SciPy 1.13.0 (2024-04-02) removed scipy.linalg.tri, tril and triu; 1.11 and 1.12 warned. Use numpy.triu, numpy.tril and numpy.tri, which take the same arguments. gensim 4.3.2 and earlier import triu from scipy.linalg in gensim/matutils.py and fail on import; gensim 4.3.3 (2024-07-19) takes it from numpy. Upgrade gensim, or pin scipy<1.13.

How do I fix "cannot import name 'simps' from 'scipy.integrate'"?

SciPy 1.14.0 (2024-06-24) removed simps, trapz and cumtrapz. Use scipy.integrate.simpson, trapezoid and cumulative_trapezoid.

How do I fix "'csr_matrix' object has no attribute 'A'"?

SciPy 1.14.0 removed the .A and .H attributes of the sparse matrix classes. Use .toarray() for .A and .T.conjugate() (or .conj().T) for .H.

How do I fix "cannot import name 'imread' from 'scipy.misc'"?

SciPy 1.3.0 (2019-05-17) removed the image functions of scipy.misc (imread, imsave, imresize, imrotate, imshow, toimage, fromimage, bytescale, imfilter); 1.2.3 is the last release with them, and they needed Pillow. Read and write images with imageio (imageio.imread) or Pillow; resize with Pillow's Image.resize. The same release removed misc.comb, factorial and logsumexp: import them from scipy.special.

Why does "module 'scipy' has no attribute 'interp'" (or 'array', 'zeros') appear?

Until 1.11 the scipy namespace re-exported NumPy's functions. SciPy 1.12.0 (2024-01-20) removed 539 of them. Call them on numpy: np.interp, np.array.

Sources

The same data as JSON: scipy_names.json, licensed CC BY 4.0.

Related: "module 'numpy' has no attribute 'float_'" · "'DataFrame' object has no attribute 'append'" · "No module named 'torchvision.transforms.functional_tensor'".