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

简介: import statsmodels.api as sm 时 ImportError: DLL load failed while importing _arpack:


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




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


(base) C:\Users\Administrator>pipuninstallstatsmodelsFoundexistinginstallation: statsmodels0.11.1Uninstallingstatsmodels-0.11.1:
Wouldremove:
d:\python\anaconda3\lib\site-packages\statsmodels-0.11.1.dist-info\*d:\python\anaconda3\lib\site-packages\statsmodels\*Proceed (y/n)?ySuccessfullyuninstalledstatsmodels-0.11.1(base) C:\Users\Administrator>pipinstallstatsmodels==0.12.0-ihttp://pypi.douban.com/simple--trusted-hostpypi.douban.comLookinginindexes: http://pypi.douban.com/simpleCollectingstatsmodels==0.12.0Downloadinghttp://pypi.doubanio.com/packages/37/22/959fdc710b6b384ad21a876130000557163978880dc50e16ba5d4ce35c18/statsmodels-0.12.0-cp38-none-win_amd64.whl (9.2MB)
|████████████████████████████████|9.2MB6.4MB/sRequirementalreadysatisfied: scipy>=1.1ind:\python\anaconda3\lib\site-packages (fromstatsmodels==0.12.0) (1.5.0)
Requirementalreadysatisfied: numpy>=1.15ind:\python\anaconda3\lib\site-packages (fromstatsmodels==0.12.0) (1.20.3)
Requirementalreadysatisfied: pandas>=0.21ind:\python\anaconda3\lib\site-packages (fromstatsmodels==0.12.0) (1.3.4)
Requirementalreadysatisfied: patsy>=0.5ind:\python\anaconda3\lib\site-packages (fromstatsmodels==0.12.0) (0.5.1)
Requirementalreadysatisfied: python-dateutil>=2.7.3ind:\python\anaconda3\lib\site-packages (frompandas>=0.21->statsmodels==0.12.0) (2.8.1)
Requirementalreadysatisfied: pytz>=2017.3ind:\python\anaconda3\lib\site-packages (frompandas>=0.21->statsmodels==0.12.0) (2020.1)
Requirementalreadysatisfied: sixind:\python\anaconda3\lib\site-packages (frompatsy>=0.5->statsmodels==0.12.0) (1.15.0)
Installingcollectedpackages: statsmodelsSuccessfullyinstalledstatsmodels-0.12.0(base) C:\Users\Administrator>pipshowscipyName: scipyVersion: 1.5.0Summary: SciPy: ScientificLibraryforPythonHome-page: https://www.scipy.orgAuthor: NoneAuthor-email: NoneLicense: BSDLocation: d:\python\anaconda3\lib\site-packagesRequires: numpyRequired-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>pipuninstallscipyFoundexistinginstallation: scipy1.5.0Uninstallingscipy-1.5.0:
Wouldremove:
d:\python\anaconda3\lib\site-packages\scipy-1.5.0.dist-info\*d:\python\anaconda3\lib\site-packages\scipy\*Proceed (y/n)?ySuccessfullyuninstalledscipy-1.5.0ERROR: Exception:
Traceback (mostrecentcalllast):
File"D:\python\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line188, in_mainstatus=self.run(options, args)
File"D:\python\Anaconda3\lib\site-packages\pip\_internal\commands\uninstall.py", line89, inrununinstall_pathset.commit()
File"D:\python\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line450, incommitself._moved_paths.commit()
File"D:\python\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line290, incommitsave_dir.cleanup()
File"D:\python\Anaconda3\lib\site-packages\pip\_internal\utils\temp_dir.py", line196, incleanuprmtree(self._path)
File"D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line49, inwrapped_freturnRetrying(*dargs, **dkw).call(f, *args, **kw)
File"D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line212, incallraiseattempt.get()
File"D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line247, ingetsix.reraise(self.value[0], self.value[1], self.value[2])
File"D:\python\Anaconda3\lib\site-packages\pip\_vendor\six.py", line703, inreraiseraisevalueFile"D:\python\Anaconda3\lib\site-packages\pip\_vendor\retrying.py", line200, incallattempt=Attempt(fn(*args, **kwargs), attempt_number, False)
File"D:\python\Anaconda3\lib\site-packages\pip\_internal\utils\misc.py", line135, inrmtreeshutil.rmtree(dir, ignore_errors=ignore_errors,
File"D:\python\Anaconda3\lib\shutil.py", line737, inrmtreereturn_rmtree_unsafe(path, onerror)
File"D:\python\Anaconda3\lib\shutil.py", line610, in_rmtree_unsafe_rmtree_unsafe(fullname, onerror)
File"D:\python\Anaconda3\lib\shutil.py", line610, in_rmtree_unsafe_rmtree_unsafe(fullname, onerror)
File"D:\python\Anaconda3\lib\shutil.py", line615, in_rmtree_unsafeonerror(os.unlink, fullname, sys.exc_info())
File"D:\python\Anaconda3\lib\shutil.py", line613, in_rmtree_unsafeos.unlink(fullname)
PermissionError: [WinError5] 拒绝访问。: 'D:\\python\\Anaconda3\\Lib\\site-packages\\~cipy\\fft\\_pocketfft\\pypocketfft.cp38-win_amd64.pyd'(base) C:\Users\Administrator>pipinstallscipy--user-ihttp://pypi.douban.com/simple--trusted-hostpypi.douban.comLookinginindexes: http://pypi.douban.com/simpleCollectingscipyDownloadinghttp://pypi.doubanio.com/packages/56/a3/591dbf477c35f173279afa7b9ba8e13d9c7c3d001e09aebbf6100aae33a8/scipy-1.8.0-cp38-cp38-win_amd64.whl (36.9MB)
|████████████████████████████████|36.9MB3.3MB/sRequirementalreadysatisfied: numpy<1.25.0,>=1.17.3ind:\python\anaconda3\lib\site-packages (fromscipy) (1.20.3)
Installingcollectedpackages: scipySuccessfullyinstalledscipy-1.8.0(base) C:\Users\Administrator>pythonPython3.8.3 (default, Jul22020, 17:30:36) [MSCv.191664bit (AMD64)] :: Anaconda, Inc. onwin32Type"help", "copyright", "credits"or"license"formoreinformation.
>>>importstatsmodels.apiassmTraceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"D:\python\Anaconda3\lib\site-packages\statsmodels\api.py", line27, in<module>from .tsaimportapiastsaFile"D:\python\Anaconda3\lib\site-packages\statsmodels\tsa\api.py", line31, in<module>from .filtersimportapiasfiltersFile"D:\python\Anaconda3\lib\site-packages\statsmodels\tsa\filters\api.py", line6, in<module>from .filtertoolsimportmiso_lfilter, convolution_filter, recursive_filterFile"D:\python\Anaconda3\lib\site-packages\statsmodels\tsa\filters\filtertools.py", line18, in<module>fromscipy.signal.signaltoolsimport_centeredastrim_centeredImportError: cannotimportname'_centered'from'scipy.signal.signaltools' (C:\Users\Administrator\AppData\Roaming\Python\Python38\site-packages\scipy\signal\signaltools.py)
>>>exitUseexit() orCtrl-ZplusReturntoexit>>>exit()
(base) C:\Users\Administrator>pipinstallscipy==1.6--user-ihttp://pypi.douban.com/simple--trusted-hostpypi.douban.coLookinginindexes: http://pypi.douban.com/simpleWARNING: Therepositorylocatedatpypi.douban.comisnotatrustedorsecurehostandisbeingignored. IfthisrepositoryisavailableviaHTTPSwerecommendyouuseHTTPSinstead, otherwiseyoumaysilencethiswarningandallowitanywaywith'--trusted-host pypi.douban.com'.
ERROR: Couldnotfindaversionthatsatisfiestherequirementscipy==1.6 (fromversions: none)
ERROR: Nomatchingdistributionfoundforscipy==1.6(base) C:\Users\Administrator>pipinstallscipy==1.6.0--user-ihttp://pypi.douban.com/simple--trusted-hostpypi.douban.comLookinginindexes: http://pypi.douban.com/simpleCollectingscipy==1.6.0Downloadinghttp://pypi.doubanio.com/packages/a1/05/9b41f6a969a0d6ad36732bdd3c936434228dafaa829932be5a51574e4958/scipy-1.6.0-cp38-cp38-win_amd64.whl (32.7MB)
|████████████████████████████████|32.7MB3.2MB/sRequirementalreadysatisfied: numpy>=1.16.5ind:\python\anaconda3\lib\site-packages (fromscipy==1.6.0) (1.20.3)
Installingcollectedpackages: scipyAttemptinguninstall: scipyFoundexistinginstallation: scipy1.8.0Uninstallingscipy-1.8.0:
Successfullyuninstalledscipy-1.8.0Successfullyinstalledscipy-1.6.0(base) C:\Users\Administrator>pythonPython3.8.3 (default, Jul22020, 17:30:36) [MSCv.191664bit (AMD64)] :: Anaconda, Inc. onwin32Type"help", "copyright", "credits"or"license"formoreinformation.
>>>importstatsmodels.apiassm>>>


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



print(":".join(["CSDN叶庭云", "https://yetingyun.blog.csdn.net/"]))
目录
相关文章
|
监控 编译器 API
[笔记]Windows核心编程《二十二》注入DLL和拦截API(一)
[笔记]Windows核心编程《二十二》注入DLL和拦截API
264 0
|
4月前
|
SQL Java 数据库
flyway报错Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration
flyway报错Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration
61 1
|
4月前
|
测试技术 API
8-20|https://gitlab.xx.com/api/v4/projects/4/trigger/pipeline Request failed 状态码400
8-20|https://gitlab.xx.com/api/v4/projects/4/trigger/pipeline Request failed 状态码400
|
5月前
|
移动开发 开发框架 小程序
开发H5程序或者小程序的时候,后端Web API项目在IISExpress调试中使用IP地址,便于开发调试
开发H5程序或者小程序的时候,后端Web API项目在IISExpress调试中使用IP地址,便于开发调试
|
5月前
|
API
【Azure API 管理】解决API Management添加AAD Group时遇见的 Failed to query Azure Active Directory graph due to error 错误
【Azure API 管理】解决API Management添加AAD Group时遇见的 Failed to query Azure Active Directory graph due to error 错误
|
5月前
|
XML 缓存 API
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
|
5月前
|
API 数据安全/隐私保护 网络架构
【Azure API 管理】解决调用REST API操作APIM(API Management)需要认证问题(Authentication failed, The 'Authorization' header is missing)
【Azure API 管理】解决调用REST API操作APIM(API Management)需要认证问题(Authentication failed, The 'Authorization' header is missing)
|
8月前
|
API Python Windows
python3应用windows api对后台程序窗口及桌面截图并保存的方法
python3应用windows api对后台程序窗口及桌面截图并保存的方法
554 1
|
7月前
|
SQL 分布式计算 DataWorks
DataWorks操作报错合集之调用ListInstances API时报错:ServiceUnavailable The request has failed due to a temporary failure of the server.是什么导致的
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
|
7月前
|
XML JSON API
RESTful API关键部分组成和构建web应用程序步骤
RESTful API关键部分组成和构建web应用程序步骤
48 0