1.现象
今天学习PaddleScience时,遇到qmc导入错误,具体如下:
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/__init__.py:107: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import MutableMapping /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/rcsetup.py:20: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Iterable, Mapping /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/matplotlib/colors.py:53: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Sized Traceback (most recent call last): File "ldc2d_steady_train.py", line 15, in <module> import paddlescience as psci File "/home/aistudio/ldc_project/PaddleScience/paddlescience/__init__.py", line 21, in <module> from . import geometry File "/home/aistudio/ldc_project/PaddleScience/paddlescience/geometry/__init__.py", line 15, in <module> from .rectangular import Rectangular, Cube, CircleInRectangular, CylinderInCube File "/home/aistudio/ldc_project/PaddleScience/paddlescience/geometry/rectangular.py", line 19, in <module> from scipy.stats import qmc ImportError: cannot import name 'qmc' from 'scipy.stats' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/scipy/stats/__init__.py)
经查发现
pip list|grep scipy scipy 1.6.3 Note: you may need to restart the kernel to use updated packages.
发现 aistudio 上默认scipy 版本为1.6.3,推测版本过低导致。
2.问题解决
qmc
模块是在scipy的1.7.0版本(2021年7月左右)中添加的。 故需要更新软件包。
!pip install -U scipy pip list|grep scipy scipy 1.7.3 Note: you may need to restart the kernel to use updated packages.
更新后问题排除!!!