【问题标题】:Resolve warning "A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy"?解决警告“此版本的 SciPy 需要 NumPy 版本 >=1.16.5 和 <1.23.0”?
【发布时间】:2022-08-03 16:59:31
【问题描述】:
当我导入 SciPy 或依赖它的库时,我收到以下警告消息:
UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.23.1
我运行的是 NumPy 版本 1.23.1 是真的,但是这条消息对我来说是个谜,因为我运行的是 SciPy 版本 1.7.3,根据SciPy\'s documentation,它与 NumPy <1.24.0 兼容。
有人遇到这个问题或知道如何解决吗?
我使用 Conda 作为环境管理器,据我所知,我的所有软件包都是最新的。
- 蟒蛇:3.9.12
- numpy:1.23.1
- scipy:1.7.3
如果有人有任何线索,请提前感谢!
标签:
python
numpy
scipy
conda
【解决方案1】:
根据scipy 1.7.3的setup.py文件,numpy确实是<1.23.0。正如@Libra 所说,文档一定是不正确的。你可以:
- 忽略此警告
- 使用 scipy 1.8
- 使用 numpy < 1.23.0
【解决方案2】:
我有同样的问题。
scipy 1.7.3 docs 指定
1.16.5 <= numpy <1.24.0 在 scipy 1.7.3 代码中 setup.py 和 __init__.py 我们有 np_maxversion = '1.23.0'。
由于我依赖 conda channel defaults 为 numpy 和 scipy 设置 Intel MKL 库,因此我决定固定 "numpy>=1.22.3,<1.23.0",直到在 conda channel defaults 上发布更新的 scipy:
conda create -n myenv python "numpy>=1.22.3,<1.23.0" scipy