开发者社区> 叶庭云> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

import statsmodels.api as sm 时 ImportError: DLL load failed while importing _arpack: 找不到指定的程序。

简介: import statsmodels.api as sm 时 ImportError: DLL load failed while importing _arpack:
+关注继续查看

image


import statsmodels.api as sm 时 报错如下:


image


image


解决过程曲折,大致就是 scipy 版本与 statsmodels 的有些方法 不兼容,scipy==1.6.0后,问题解决了:



(base) C:\Users\Administrator>pip uninstall statsmodels
Found existing installation: statsmodels 0.11.1
Uninstalling statsmodels-0.11.1:
  Would remove:
    d:\python\anaconda3\lib\site-packages\statsmodels-0.11.1.dist-info\*
    d:\python\anaconda3\lib\site-packages\statsmodels\*
Proceed (y/n)? y
  Successfully uninstalled statsmodels-0.11.1

(base) C:\Users\Administrator>pip install statsmodels==0.12.0 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting statsmodels==0.12.0
  Downloading http://pypi.doubanio.com/packages/37/22/959fdc710b6b384ad21a876130000557163978880dc50e16ba5d4ce35c18/statsmodels-0.12.0-cp38-none-win_amd64.whl (9.2 MB)
     |████████████████████████████████| 9.2 MB 6.4 MB/s
Requirement already satisfied: scipy>=1.1 in d:\python\anaconda3\lib\site-packages (from statsmodels==0.12.0) (1.5.0)
Requirement already satisfied: numpy>=1.15 in d:\python\anaconda3\lib\site-packages (from statsmodels==0.12.0) (1.20.3)
Requirement already satisfied: pandas>=0.21 in d:\python\anaconda3\lib\site-packages (from statsmodels==0.12.0) (1.3.4)
Requirement already satisfied: patsy>=0.5 in d:\python\anaconda3\lib\site-packages (from statsmodels==0.12.0) (0.5.1)
Requirement already satisfied: python-dateutil>=2.7.3 in d:\python\anaconda3\lib\site-packages (from pandas>=0.21->statsmodels==0.12.0) (2.8.1)
Requirement already satisfied: pytz>=2017.3 in d:\python\anaconda3\lib\site-packages (from pandas>=0.21->statsmodels==0.12.0) (2020.1)
Requirement already satisfied: six in d:\python\anaconda3\lib\site-packages (from patsy>=0.5->statsmodels==0.12.0) (1.15.0)
Installing collected packages: statsmodels
Successfully installed statsmodels-0.12.0

(base) C:\Users\Administrator>pip show scipy
Name: scipy
Version: 1.5.0
Summary: SciPy: Scientific Library for Python
Home-page: https://www.scipy.org
Author: None
Author-email: None
License: BSD
Location: d:\python\anaconda3\lib\site-packages
Requires: numpy
Required-by: -tatsmodels, xgboost, wxgl, sweetviz, stldecompose, statsmodels, sesd, seaborn, scikit-learn, scikit-image, resampy, pyod, mplsoccer, missingno, lightgbm, librosa, imgaug, imbalanced-learn, gensim, filterpy, factor-analyzer, combo, category-encoders, catboost, bayesian-optimization, albumentations

(base) C:\Users\Administrator>pip uninstall scipy
Found existing installation: scipy 1.5.0
Uninstalling scipy-1.5.0:
  Would remove:
    d:\python\anaconda3\lib\site-packages\scipy-1.5.0.dist-info\*
    d:\python\anaconda3\lib\site-packages\scipy\*
Proceed (y/n)? y
  Successfully uninstalled scipy-1.5.0
ERROR: Exception:
Traceback (most recent call last):
  File "D:\python\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in _main
    status = self.run(options, args)
  File "D:\python\Anaconda3\lib\site-packages\pip\_internal\commands\uninstall.py", line 89, in run
    uninstall_pathset.commit()
  File "D:\python\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 450, in commit
    self._moved_paths.commit()
  File "D:\python\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 290, in commit
    save_dir.cleanup()
  File "D:\python\Anaconda3\lib\site-packages\pip\_internal\utils\temp_dir.py", line 196, in cleanup
    rmtree(self._path)
  File "D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line 49, in wrapped_f
    return Retrying(*dargs, **dkw).call(f, *args, **kw)
  File "D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line 212, in call
    raise attempt.get()
  File "D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line 247, in get
    six.reraise(self.value[0], self.value[1], self.value[2])
  File "D:\python\Anaconda3\lib\site-packages\pip\_vendor\six.py", line 703, in reraise
    raise value
  File "D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line 200, in call
    attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
  File "D:\python\Anaconda3\lib\site-packages\pip\_internal\utils\misc.py", line 135, in rmtree
    shutil.rmtree(dir, ignore_errors=ignore_errors,
  File "D:\python\Anaconda3\lib\shutil.py", line 737, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "D:\python\Anaconda3\lib\shutil.py", line 610, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "D:\python\Anaconda3\lib\shutil.py", line 610, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "D:\python\Anaconda3\lib\shutil.py", line 615, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "D:\python\Anaconda3\lib\shutil.py", line 613, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] 拒绝访问。: 'D:\\python\\Anaconda3\\Lib\\site-packages\\~cipy\\fft\\_pocketfft\\pypocketfft.cp38-win_amd64.pyd'

(base) C:\Users\Administrator>pip install scipy --user -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting scipy
  Downloading http://pypi.doubanio.com/packages/56/a3/591dbf477c35f173279afa7b9ba8e13d9c7c3d001e09aebbf6100aae33a8/scipy-1.8.0-cp38-cp38-win_amd64.whl (36.9 MB)
     |████████████████████████████████| 36.9 MB 3.3 MB/s
Requirement already satisfied: numpy<1.25.0,>=1.17.3 in d:\python\anaconda3\lib\site-packages (from scipy) (1.20.3)
Installing collected packages: scipy
Successfully installed scipy-1.8.0

(base) C:\Users\Administrator>python
Python 3.8.3 (default, Jul  2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import statsmodels.api as sm
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\python\Anaconda3\lib\site-packages\statsmodels\api.py", line 27, in <module>
    from .tsa import api as tsa
  File "D:\python\Anaconda3\lib\site-packages\statsmodels\tsa\api.py", line 31, in <module>
    from .filters import api as filters
  File "D:\python\Anaconda3\lib\site-packages\statsmodels\tsa\filters\api.py", line 6, in <module>
    from .filtertools import miso_lfilter, convolution_filter, recursive_filter
  File "D:\python\Anaconda3\lib\site-packages\statsmodels\tsa\filters\filtertools.py", line 18, in <module>
    from scipy.signal.signaltools import _centered as trim_centered
ImportError: cannot import name '_centered' from 'scipy.signal.signaltools' (C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\scipy\signal\signaltools.py)
>>> exit
Use exit() or Ctrl-Z plus Return to exit
>>> exit()

(base) C:\Users\Administrator>pip install scipy==1.6 --user -i http://pypi.douban.com/simple --trusted-host pypi.douban.co
Looking in indexes: http://pypi.douban.com/simple
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
ERROR: Could not find a version that satisfies the requirement scipy==1.6 (from versions: none)
ERROR: No matching distribution found for scipy==1.6

(base) C:\Users\Administrator>pip install scipy==1.6.0 --user -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
Looking in indexes: http://pypi.douban.com/simple
Collecting scipy==1.6.0
  Downloading http://pypi.doubanio.com/packages/a1/05/9b41f6a969a0d6ad36732bdd3c936434228dafaa829932be5a51574e4958/scipy-1.6.0-cp38-cp38-win_amd64.whl (32.7 MB)
     |████████████████████████████████| 32.7 MB 3.2 MB/s
Requirement already satisfied: numpy>=1.16.5 in d:\python\anaconda3\lib\site-packages (from scipy==1.6.0) (1.20.3)
Installing collected packages: scipy
  Attempting uninstall: scipy
    Found existing installation: scipy 1.8.0
    Uninstalling scipy-1.8.0:
      Successfully uninstalled scipy-1.8.0
Successfully installed scipy-1.6.0

(base) C:\Users\Administrator>python
Python 3.8.3 (default, Jul  2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import statsmodels.api as sm
>>>


解决后,重启jupyter notebook,进入可以正常使用。


image


print(":".join(["CSDN叶庭云", "https://yetingyun.blog.csdn.net/"]))

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
关于最新版本的Anaconda里面的Spyder里总出现 ‘DLL load failed: 找不到指定的模块’ 的问题
关于最新版本的Anaconda里面的Spyder里总出现 ‘DLL load failed: 找不到指定的模块’ 的问题
10 0
剑指Offer——二叉搜索树的第K大的节点(JS实现)
剑指Offer——二叉搜索树的第K大的节点(JS实现)
52 0
周博磊知乎热答:如何评价何恺明大神斩获ICCV 2017最佳论文
2017年10月24日下午,Facebook AI 研究员何恺明大神斩获ICCV 2017最佳论文,这是他第三次斩获顶会最佳论文,对于Kaiming He 在 ICCV 2017 上拿下双 Best的paper,他的中大同学,另一位大神周博磊在知乎写了一段他眼中的凯明师兄。
6567 0
DockOne微信分享(七十二):Kubernetes容器集群中的日志系统集成实践
本文讲的是DockOne微信分享(七十二):Kubernetes容器集群中的日志系统集成实践【编者的话】本次课程将分享如何利用Fluentd、ElasticSearch、Kibana在Kubernetes集群中构建一个高可用高可扩展的日志系统,来收集、处理、分析和展示Kubernetes集群中的容器日志。
3334 0
HTML5 画布上的 Three.js 环境灯光(HTML5 Canvas Three.js Ambient Lighting)
HTML5 画布上的 Three.js 环境灯光(HTML5 Canvas Three.js Ambient Lighting) 太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循“署名-非商业用途-保持一致”创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS、Android、Html5、Arduino、pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作。
957 0
statspack的IO操作及Buffer Hit Rate
--物理讀寫操作 select distinct to_char(snap_time, 'yyyy-mm-dd HH24:MI:SS') datetime,                 (newreads.
645 0
艾伟_转载:WCF版的PetShop之三:实现分布式的Membership和上下文传递
本系列文章导航 WCF版的PetShop之一:PetShop简介 WCF版的PetShop之二:模块中的层次划分 WCF版的PetShop之三:实现分布式的Membership和上下文传递   通过上一篇了解了模块内基本的层次划分之后,接下来我们来聊聊PetShop中一些基本基础功能的实现,以及一些设计、架构上的应用如何同WCF进行集成。
981 0
+关注
文章
问答
文章排行榜
最热
最新
相关电子书
更多
Data Pre-Processing in Python:
立即下载
Using Hadoop to build a Data Quality Service for both real-time and batch data
立即下载
Java8简明教...[fredwong].1494561200.pdf
立即下载