我试图安装R包fGarch一段时间,但似乎有一个问题。我使用以下命令:
import rpy2.interactive as r
import rpy2.interactive.packages
rlib = r.packages.packages
r.packages.importr("utils")
package_name = "fGarch"
rlib.utils.install_packages(package_name)安装过程基本正常,除了最后的警告:
/home/vdesai/anaconda/lib/python2.7/site-packages/rpy2/robjects/packages.py:216: UserWarning: Conflict when converting R symbol in the package "tools" to a Python symbol (package.dependencies -> package_dependencies while there is already package_dependencies)
warn(msg)当我尝试使用以下命令加载程序包时:
%R library(fGarch)我得到以下错误:
Error in library(fGarch) : there is no package called ‘fGarch’
In addition: Warning messages:
1: In (function (pkgs, lib, repos = getOption("repos"), contriburl = contrib.url(repos, :
installation of package ‘MASS’ had non-zero exit status
2: In (function (pkgs, lib, repos = getOption("repos"), contriburl = contrib.url(repos, :
installation of package ‘fBasics’ had non-zero exit status
3: In (function (pkgs, lib, repos = getOption("repos"), contriburl = contrib.url(repos, :
installation of package ‘fGarch’ had non-zero exit status
Error in library(fGarch) : there is no package called ‘fGarch’请注意,使用Rstudio中的这个包不会造成任何困难。有人能帮帮忙吗?
发布于 2014-11-04 20:26:59
我找到了以下问题的答案。其主要思想是1)安装anaconda,它提供了一个很好的python发行版2)通过conda运行命令来安装R:"conda install -- rpy2 https://conda.binstar.org/r r“3)通过运行"conda install -- https://conda.binstar.org/r https://conda.binstar.org/r rpy2”来安装通道。
现在,如果您尝试从ipython notebook安装fGarch,我过去常常在安装依赖项MASS时遇到错误。但这些依赖项在conda channel r中以软件包的形式提供,我们可以使用以下命令安装它们: conda install --channel https://conda.binstar.org/r r-mass install --channel https://conda.binstar.org/r r-fbasics那么,您应该能够从ipython notebook安装fGarch。
这种方法的好处是,如果事情没有按计划进行,您可以随时删除包目录或整个anaconda目录。因此,它很容易进行实验。
https://stackoverflow.com/questions/26245719
复制相似问题