【发布时间】:2020-10-20 07:11:18
【问题描述】:
我想使用 rmgarch 进行多变量时间序列分析,因为 Python 没有多变量模型,我正在尝试使用 R 的 rmgarch 包。
我正在尝试使用以下代码在 Colab Python 环境中导入 rmgarch 模型。
下面是它返回的错误,有人遇到过这样的问题吗?
from rpy2.robjects.packages import importr
package_name = "rmgarch"
try:
pkg = importr(package_name)
except:
ro.r(f'install.packages("{package_name}")')
pkg = importr(package_name,lib_loc='/usr/local/lib/R/site-library')
pkg
错误:
R[write to console]: Error in loadNamespace(name) : there is no package called ‘rmgarch’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
R[write to console]: Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
R[write to console]: also installing the dependencies ‘gmp’, ‘Rmpfr’, ‘Bessel’
R[write to console]: The downloaded source packages are in
‘/tmp/RtmpI6uWBQ/downloaded_packages’
R[write to console]: Error in loadNamespace(name) : there is no package called ‘rmgarch’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
R[write to console]: In addition:
R[write to console]: Warning messages:
R[write to console]: In install.packages("rmgarch") :
R[write to console]: installation of package ‘gmp’ had non-zero exit status
R[write to console]: 2:
R[write to console]: In install.packages("rmgarch") :
R[write to console]: installation of package ‘Rmpfr’ had non-zero exit status
R[write to console]: In install.packages("rmgarch") :
R[write to console]: installation of package ‘Bessel’ had non-zero exit status
R[write to console]: In install.packages("rmgarch") :
R[write to console]: installation of package ‘rmgarch’ had non-zero exit status
---------------------------------------------------------------------------
RRuntimeError Traceback (most recent call last)
<ipython-input-49-e4fba63eb683> in <module>()
7 try:
----> 8 pkg = importr(package_name)
9 except:
6 frames
RRuntimeError: Error in loadNamespace(name) : there is no package called ‘rmgarch’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
During handling of the above exception, another exception occurred:
RRuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/rpy2/rinterface.py in __call__(self, *args, **kwargs)
787 error_occured))
788 if error_occured[0]:
--> 789 raise embedded.RRuntimeError(_rinterface._geterrmessage())
790 return res
791
RRuntimeError: Error in loadNamespace(name) : there is no package called ‘rmgarch’
Calls: <Anonymous> ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
【问题讨论】:
标签: python r machine-learning time-series google-colaboratory