在R中安装插入包时的依赖性问题

时间:2014-12-15 06:12:33

标签: r r-caret

我正在尝试安装R包caret

这给了我ERROR: dependencies ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’ are not available for package ‘caret’

我试图单独安装每一个,这再次显示正在进行的安装,以installation of package ‘X’ had non-zero exit status

的消息结束
1: In install.packages("caret") :
  installation of package ‘minqa’ had non-zero exit status
2: In install.packages("caret") :
  installation of package ‘RcppEigen’ had non-zero exit status
3: In install.packages("caret") :
  installation of package ‘scales’ had non-zero exit status
4: In install.packages("caret") :
  installation of package ‘reshape2’ had non-zero exit status
5: In install.packages("caret") :
  installation of package ‘lme4’ had non-zero exit status
6: In install.packages("caret") :
  installation of package ‘ggplot2’ had non-zero exit status
7: In install.packages("caret") :
  installation of package ‘BradleyTerry2’ had non-zero exit status
8: In install.packages("caret") :
  installation of package ‘caret’ had non-zero exit status

以递归方式请求安装一些软件包。有什么问题?

我有旧版本,我遇到了类似的错误。我删除并安装了最新版本。目前版本为R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet",但仍会收到类似的错误消息

更新

以:install.packages('caret', repos='http://cran.rstudio.com/')开始显示消息:

Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘RcppEigen’, ‘scales’, ‘lme4’, ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’

并且流程以:

结束
installing to /usr/local/lib/R/site-library/reshape2/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error : package ‘stringr’ was built before R 3.0.0: please re-install it
ERROR: lazy loading failed for package ‘reshape2’
* removing ‘/usr/local/lib/R/site-library/reshape2’
ERROR: dependencies ‘minqa’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/usr/local/lib/R/site-library/lme4’
ERROR: dependencies ‘reshape2’, ‘scales’ are not available for package ‘ggplot2’
* removing ‘/usr/local/lib/R/site-library/ggplot2’
ERROR: dependency ‘lme4’ is not available for package ‘BradleyTerry2’
* removing ‘/usr/local/lib/R/site-library/BradleyTerry2’
ERROR: dependencies ‘ggplot2’, ‘reshape2’, ‘BradleyTerry2’ are not available for package ‘caret’
* removing ‘/usr/local/lib/R/site-library/caret’

The downloaded source packages are in
    ‘/tmp/RtmpcLo8Rw/downloaded_packages’
Warning messages:
1: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘minqa’ had non-zero exit status
2: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘RcppEigen’ had non-zero exit status
3: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘scales’ had non-zero exit status
4: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘reshape2’ had non-zero exit status
5: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘lme4’ had non-zero exit status
6: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘ggplot2’ had non-zero exit status
7: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘BradleyTerry2’ had non-zero exit status
8: In install.packages("caret", repos = "http://cran.rstudio.com/") :
  installation of package ‘caret’ had non-zero exit status

8 个答案:

答案 0 :(得分:9)

我安装插入包时遇到类似的问题。 我发现的问题是由更新包依赖引起的。 更新某些软件包也会更改其可能没有正确版本的依赖关系,以便以后在其他软件包中使用。 就像我安装插入符一样,它显示了:

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : there is no package called minqa?

我找到的解决方案是首先找到导致问题的包。您只需安装所需的软件包即可获得此信息。对我来说,一个是&#34; minqa&#34;。 所以只需独立安装这个包。

install.packages("minqa")

我的问题以这种方式解决了。

对于你,你需要安装&#34;'minqa','RcppEigen','scale','lme4','ggplot2','reshape2','BradleyTerry2'和#34;一个接一个。

答案 1 :(得分:9)

caret Documentation suggests执行install.packages("caret", dependencies = c("Depends", "Suggests"))以确保安装所有需要的软件包并解决所有依赖项

答案 2 :(得分:2)

在尝试在R上安装插入符时,我遇到了类似的依赖项问题:

> install.packages("caret", contriburl = "file:///usr/repo_AO/CRAN/")
ERROR: dependency ‘car’ is not available for package ‘caret’

> install.packages("car", contriburl = "file:///usr/repo_AO/CRAN/")
Installing package into ‘/usr/share/R/library-users’
(as ‘lib’ is unspecified)
Warning message:
package ‘car’ is not available (for R version 3.1.2) 

'car' package is for >= R 3.2
> R.version                
version.string R version 3.1.2 (2014-10-31)

我发现&#39; caret&#39;我从O.S.安装后再也没有问过依赖项了。一辆年纪较大的汽车&#39;版本来自R-car-2.0_21-1.8.x86_64.rpm包:

$ sudo yum install --nogpgcheck R-car-2.0_21-1.8.x86_64.rpm
Setting up Install Process
Examining R-car-2.0_21-1.8.x86_64.rpm: R-car-2.0_21-1.8.x86_64
Marking R-car-2.0_21-1.8.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package R-car.x86_64 0:2.0_21-1.8 will be installed
--> Finished Dependency Resolution
---8<---
Installed:
  R-car.x86_64 0:2.0_21-1.8                                                              
    Complete!

然后:

    > install.packages("caret", contriburl = "file:///usr/repo_AO/CRAN/")
    Installing package into ‘/usr/share/R/library-users’
    (as ‘lib’ is unspecified)
    also installing the dependency ‘ggplot2’
    * installing *source* package ‘ggplot2’ ...
    ** package ‘ggplot2’ successfully unpacked and MD5 sums checked
    ----8<----
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
    * DONE (ggplot2)
    * installing *source* package ‘caret’ ...
    ** package ‘caret’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG  -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c caret.c -o caret.o
    gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o caret.so caret.o -L/usr/lib64/R/lib -lR
    installing to /usr/share/R/library-users/caret/libs
    ----8<----
    ** testing if installed package can be loaded
    * DONE (caret)

(*)我使用了本地存储库,因为没有直接的互联网连接,但回购地点无关紧要。

答案 3 :(得分:2)

  • 在Linux Mint 17.3 KDE&#34; Rosa&#34; (64位),x86_64-pc-linux-gnu,
  • 安装R版本3.3.0(2016-05-03) - &#34;据说教育&#34;。

我有几个包(汽车,素食主义者,精神病......)的类似问题。它是通过在命令行(终端)中运行来解决的:

sudo apt-get install r-base-dev

R

> install.packages("car")

Suerte!

答案 4 :(得分:0)

我有类似的问题。我用了

install.packages("caret", dependencies = c("Depends"), repos='http://cran.rstudio.com/')
并得到了 ERROR: dependency 'car' is not available for package 'caret'
通过R单独安装汽车不起作用,但我的发行包(Fedora)的包管理器 dnf install R-car

然后第一个命令成功了。

答案 5 :(得分:0)

caret 包安装也遇到了类似的问题。

我使用Linux Mint 17.3 Cinnamon 64位:

  • R version 3.3.0(2016-05-03)
  • 平台:x86_64-pc-linux-gnu(64位)
  • 运行于:Ubuntu 14.04.4 LTS

使用命令

安装第一个插入符号
install.packages('caret', repos='http://cran.rstudio.com/')

给出了如下错误消息 ...

* installing *source* package ‘minqa’ ...
** package ‘minqa’ successfully unpacked and MD5 sums checked
** libs
gfortran   -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4  -c altmov.f -o altmov.o
/bin/bash: gfortran: command not found
make: *** [altmov.o] Error 127
ERROR: compilation failed for package ‘minqa’
* removing ‘/home/myusername/R/x86_64-pc-linux-gnu-library/3.3/minqa’
Warning in install.packages :
  installation of package ‘minqa’ had non-zero exit status
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** libs

...

/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [RcppEigen.so] Error 1
ERROR: compilation failed for package ‘RcppEigen’

...

然后我试着跑

install.packages("RcppEigen")

但它没有工作,并给出了关于llapack等的相同错误。接下来我运行了linux命令行:

sudo apt-get install liblapack-dev

(这个安装必要的库)

然后是命令

install.packages("RcppEigen") 

工作得很好,也是如此

install.packages('caret', repos='http://cran.rstudio.com/')

所以这个liblapack-dev回答了我。

快乐结束并感谢您在讨论中的暗示!

答案 6 :(得分:0)

我遇到了典型的问题。
当我开始加载依赖项程序包时,我发现错误:
was installed by an R version with different internals

重新安装这些软件包对我有帮助

答案 7 :(得分:0)

我以前在Linux上安装了它,并且可以正常工作:
sudo apt-get install -y r-cran-rcppeigen