scipy: Query: `TypeError` when importing `interpolate`
Describe your issue.
Trying to import scipy.stats raises a TypeError.
Reproducing Code Example
import scipy.stats
Error message
Traceback (most recent call last):
File "/Users/reeschang/PycharmProjects/InverseXRD/raw_xrd_simulation.py", line 244, in <module>
import scipy.stats
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/stats/__init__.py", line 606, in <module>
from ._stats_py import *
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/stats/_stats_py.py", line 49, in <module>
from . import distributions
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/stats/distributions.py", line 11, in <module>
from . import _discrete_distns
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/stats/_discrete_distns.py", line 10, in <module>
from scipy.interpolate import interp1d
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/interpolate/__init__.py", line 167, in <module>
from ._interpolate import *
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py", line 14, in <module>
from . import _fitpack_py
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/interpolate/_fitpack_py.py", line 8, in <module>
from ._fitpack_impl import bisplrep, bisplev, dblint # noqa: F401
File "/Users/reeschang/miniconda3/envs/ml4pxrds/lib/python3.9/site-packages/scipy/interpolate/_fitpack_impl.py", line 103, in <module>
'iwrk': array([], dfitpack_int), 'u': array([], float),
TypeError
SciPy/NumPy/Python version and system information
1.13.1 1.26.4 sys.version_info(major=3, minor=9, micro=19, releaselevel='final', serial=0)
Build Dependencies:
blas:
detection method: pkgconfig
found: true
include directory: /Users/reeschang/miniconda3/envs/ml4pxrds/include
lib directory: /Users/reeschang/miniconda3/envs/ml4pxrds/lib
name: blas
openblas configuration: unknown
pc file directory: /Users/reeschang/miniconda3/envs/ml4pxrds/lib/pkgconfig
version: 3.9.0
lapack:
detection method: pkgconfig
found: true
include directory: /Users/reeschang/miniconda3/envs/ml4pxrds/include
lib directory: /Users/reeschang/miniconda3/envs/ml4pxrds/lib
name: lapack
openblas configuration: unknown
pc file directory: /Users/reeschang/miniconda3/envs/ml4pxrds/lib/pkgconfig
version: 3.9.0
pybind11:
detection method: pkgconfig
include directory: /Users/reeschang/miniconda3/envs/ml4pxrds/include
name: pybind11
version: 2.12.0
Compilers:
c:
args: -march=core2, -mtune=haswell, -mssse3, -ftree-vectorize, -fPIC, -fstack-protector-strong,
-O2, -pipe, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include, -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/work=/usr/local/src/conda/scipy-split-1.13.1,
-fdebug-prefix-map=/Users/reeschang/miniconda3/envs/ml4pxrds=/usr/local/src/conda-prefix,
-D_FORTIFY_SOURCE=2, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include,
-mmacosx-version-min=10.13, -mmacosx-version-min=10.13
commands: x86_64-apple-darwin13.4.0-clang
linker: ld64
linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/reeschang/miniconda3/envs/ml4pxrds/lib,
-L/Users/reeschang/miniconda3/envs/ml4pxrds/lib, -march=core2, -mtune=haswell,
-mssse3, -ftree-vectorize, -fPIC, -fstack-protector-strong, -O2, -pipe, -isystem,
/Users/reeschang/miniconda3/envs/ml4pxrds/include, -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/work=/usr/local/src/conda/scipy-split-1.13.1,
-fdebug-prefix-map=/Users/reeschang/miniconda3/envs/ml4pxrds=/usr/local/src/conda-prefix,
-D_FORTIFY_SOURCE=2, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include,
-mmacosx-version-min=10.13, -mmacosx-version-min=10.13
name: clang
version: 16.0.6
c++:
args: -march=core2, -mtune=haswell, -mssse3, -ftree-vectorize, -fPIC, -fstack-protector-strong,
-O2, -pipe, -stdlib=libc++, -fvisibility-inlines-hidden, -fmessage-length=0,
-isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include, -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/work=/usr/local/src/conda/scipy-split-1.13.1,
-fdebug-prefix-map=/Users/reeschang/miniconda3/envs/ml4pxrds=/usr/local/src/conda-prefix,
-D_FORTIFY_SOURCE=2, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include,
-mmacosx-version-min=10.13, -mmacosx-version-min=10.13
commands: x86_64-apple-darwin13.4.0-clang++
linker: ld64
linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/reeschang/miniconda3/envs/ml4pxrds/lib,
-L/Users/reeschang/miniconda3/envs/ml4pxrds/lib, -march=core2, -mtune=haswell,
-mssse3, -ftree-vectorize, -fPIC, -fstack-protector-strong, -O2, -pipe, -stdlib=libc++,
-fvisibility-inlines-hidden, -fmessage-length=0, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include,
-fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/work=/usr/local/src/conda/scipy-split-1.13.1,
-fdebug-prefix-map=/Users/reeschang/miniconda3/envs/ml4pxrds=/usr/local/src/conda-prefix,
-D_FORTIFY_SOURCE=2, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include,
-mmacosx-version-min=10.13, -mmacosx-version-min=10.13
name: clang
version: 16.0.6
cython:
commands: cython
linker: cython
name: cython
version: 3.0.10
fortran:
args: -march=core2, -mtune=haswell, -ftree-vectorize, -fPIC, -fstack-protector,
-O2, -pipe, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include, -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/work=/usr/local/src/conda/scipy-split-1.13.1,
-fdebug-prefix-map=/Users/reeschang/miniconda3/envs/ml4pxrds=/usr/local/src/conda-prefix
commands: /Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/_build_env/bin/x86_64-apple-darwin13.4.0-gfortran
linker: ld64
linker args: -Wl,-headerpad_max_install_names, -Wl,-dead_strip_dylibs, -Wl,-rpath,/Users/reeschang/miniconda3/envs/ml4pxrds/lib,
-L/Users/reeschang/miniconda3/envs/ml4pxrds/lib, -march=core2, -mtune=haswell,
-ftree-vectorize, -fPIC, -fstack-protector, -O2, -pipe, -isystem, /Users/reeschang/miniconda3/envs/ml4pxrds/include,
-fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/scipy-split_1716470285601/work=/usr/local/src/conda/scipy-split-1.13.1,
-fdebug-prefix-map=/Users/reeschang/miniconda3/envs/ml4pxrds=/usr/local/src/conda-prefix
name: gcc
version: 12.3.0
pythran:
include directory: ../../_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python3.9/site-packages/pythran
version: 0.16.0
Machine Information:
build:
cpu: x86_64
endian: little
family: x86_64
system: darwin
cross-compiled: false
host:
cpu: x86_64
endian: little
family: x86_64
system: darwin
Python Information:
path: /Users/reeschang/miniconda3/envs/ml4pxrds/bin/python
version: '3.9'
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (10 by maintainers)
I also encountered this error with Python 3.10 and SciPy 1.14.0. I solved it by downgrading SciPy to version 1.12.x:
update python to 3.12 and it works without error, thanks!
It looks like an installation problem more than a bug in a particular sub-package, but I’ve re-labeled the issue issue because the
TypeErrorappears to come frominterpolate.