Hi I am getting the “ImportError: cannot import name ‘gaussian’ from ‘scipy.signal’”. I have tried to use downgraded version of scipy, but it did not work for me.
Your help would be much appreciated.
Hi I am getting the “ImportError: cannot import name ‘gaussian’ from ‘scipy.signal’”. I have tried to use downgraded version of scipy, but it did not work for me.
Your help would be much appreciated.
You may need to update arviz instead. If that doesn’t fix it, please share the whole error message
Hi Ricardo,
Thank you for your response. It’s working perfectly now. I was using a very old version of Anaconda. Once I installed the latest version, it worked fine.
Sorry to be asking about scipy installs here, but I am also running into this problem. It appears to be a problem with scipy
before I even import arviz
.
build (benchmarks)$ python3
Python 3.9.6 (default, Apr 30 2025, 02:07:17)
[Clang 17.0.0 (clang-1700.0.13.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.signal import gaussian
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'gaussian' from 'scipy.signal' (/Users/bcarpenter/Library/Python/3.9/lib/python/site-packages/scipy/signal/__init__.py
I’ve updated scipy to the latest version.
>>> import scipy as sp
>>> sp.__version__
'1.13.1'
This is using an Apple M2 Max Mac Studio running Sequoia 15.5 (24F74).
Do I need to do something like use homebrew
to install a different version of Python?
Also, I brew installed a new version of Python with a new version of scipy and I still have the same problem.
build (benchmarks)$ /opt/homebrew/bin/python3.13
Python 3.13.5 (main, Jun 11 2025, 15:36:57) [Clang 17.0.0 (clang-1700.0.13.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy.signal import gaussian
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
from scipy.signal import gaussian
ImportError: cannot import name 'gaussian' from 'scipy.signal' (/opt/homebrew/lib/python3.13/site-packages/scipy/signal/__init__.py)
>>> import scipy as sp
>>> sp.__version__
'1.16.1'
There’s some conversation about this on the arviz github. As of scipy 1.13, scipy.signal.__init__
no longer exposes the scipy.signal.windows
namespace, so you have to directly do scipy.signal.windows.gaussian
(or scipy.signal.get_window(‘gaussian’)
), or pin scipy<1.13
(e.g. if you need to use an older version of arviz)
@bob-carpenter I saw you commented on the ArviZ thread, but given you are using SciPy directly you need to update your import from from scipy.signal import gaussian
to scipy.signal.windows import gaussian
as @jessegrabowski mentioned. The import you are trying to use stopped being valid in SciPy 1.13.
This same update was what we needed to do in ArviZ in order to support SciPy>=1.13. Consequently, you’d still get that error if you tried to use an old ArviZ release with latest SciPy, but it doesn’t look like that is your case.
I’m not importing gaussian
directly. The error comes up using import arviz
. Now that I downgraded to SciPy 1.12, it’s working.
Is there a version of ArviZ that’s compatible with SciPy 1.13?
Versions >=0.18 of ArviZ are compatible with scipy >=1.13. The PR linked above which updates the import was merged over a year ago and 0.18 released a couple weeks after. Is there any reason for not using the latest 0.22 release?
Is there any reason for not using the latest 0.22 release?
I don’t know how to install the latest ArviZ. When I try to get pip to upgrade, it says it’s already satisfied. I’m not exactly a Python power user, so it’s probably user error on my part.
park_challenge$ python3 -m pip install --upgrade arviz
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: arviz in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (0.17.1)
Requirement already satisfied: setuptools>=60.0.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (80.9.0)
Requirement already satisfied: matplotlib>=3.5 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (3.9.4)
Requirement already satisfied: numpy<2.0,>=1.22.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (1.26.4)
Requirement already satisfied: scipy>=1.8.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (1.12.0)
Requirement already satisfied: packaging in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (25.0)
Requirement already satisfied: pandas>=1.4.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (2.3.0)
Requirement already satisfied: xarray>=0.21.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (2024.7.0)
Requirement already satisfied: h5netcdf>=1.0.2 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (1.6.3)
Requirement already satisfied: typing-extensions>=4.1.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (4.14.1)
Requirement already satisfied: xarray-einstats>=0.3 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from arviz) (0.7.0)
Requirement already satisfied: h5py in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from h5netcdf>=1.0.2->arviz) (3.14.0)
Requirement already satisfied: contourpy>=1.0.1 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (1.3.0)
Requirement already satisfied: cycler>=0.10 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (4.58.2)
Requirement already satisfied: kiwisolver>=1.3.1 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (1.4.7)
Requirement already satisfied: pillow>=8 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (11.2.1)
Requirement already satisfied: pyparsing>=2.3.1 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (3.2.3)
Requirement already satisfied: python-dateutil>=2.7 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (2.9.0.post0)
Requirement already satisfied: importlib-resources>=3.2.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from matplotlib>=3.5->arviz) (6.5.2)
Requirement already satisfied: zipp>=3.1.0 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from importlib-resources>=3.2.0->matplotlib>=3.5->arviz) (3.22.0)
Requirement already satisfied: pytz>=2020.1 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from pandas>=1.4.0->arviz) (2025.2)
Requirement already satisfied: tzdata>=2022.7 in /Users/bcarpenter/Library/Python/3.9/lib/python/site-packages (from pandas>=1.4.0->arviz) (2025.2)
Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.7->matplotlib>=3.5->arviz) (1.15.0)
park_challenge$ python3
Python 3.9.6 (default, Apr 30 2025, 02:07:17)
[Clang 17.0.0 (clang-1700.0.13.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import arviz as az
>>> az.__version__
'0.17.1'
If you want to use latest libraries you need to upgrade the version of python to 3.12 or 3.13. Many libraries follow more or less Scientific Python - SPEC 0 — Minimum Supported Dependencies regarding versions to support. We loosely do at ArviZ, but NumPy and SciPy also follow them, and quite closely in their case. For example, latest SciPy is 1.16 which requires python>=3.11.
Otherwise you’ll need to add some upper pins to some packages in order to keep things aligned. Backward compatibility checks are not very extensive in general in python world, so the best bet is to use versions that were released around the same time. If you have arviz 0.17.1 which is from March 2024, so the main testing happened with scipy 1.12 (which seems to be the one you have already, I assume because you added a <1.13 pin on it), released in late January 2024
Just wanted to report back that updating everything worked.