Python cannot import name from some scipy.signal methods

Viewed 11584
import numpy as np
from scipy.integrate import odeint
from scipy.signal import find_peaks

The third line triggers the following error:

ImportError: cannot import name find_peaks

What is going on here? I haven't made any changes to the scipy package that I am aware of. Also it is worth noting that just importing scipy.signal does not produce an error.

2 Answers

Check your scipy version:

import scipy
print(scipy.__version__)

find_peaks is new in version 1.1.0.

If you want to update:

pip install scipy --upgrade

I just had to reinstall scipy and it worked on Mac OS with M1 and Python 3.9

pip uninstall scipy

and then

pip install scipy

Related