简体   繁体   English

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

[英]Dependency issue while installing caret package in R

I am trying to install R package caret我正在尝试安装 R 包caret

Which gives me ERROR: dependencies 'ggplot2', 'reshape2', 'BradleyTerry2' are not available for package 'caret'这给了我ERROR: dependencies 'ggplot2', 'reshape2', 'BradleyTerry2' are not available for package 'caret'

I tried to install each of this individually, which again shows installation going on, ending with message that installation of package 'X' had non-zero exit status我尝试单独安装每个,这再次显示安装正在进行,以消息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

Ask recursively to install some package.递归请求安装一些包。 What is the issue?问题是什么?

I had older version, where I was getting similar error.我有旧版本,在那里我遇到了类似的错误。 I removed and installed latest.我删除并安装了最新版本。 Currently version is R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" , but still getting similar error message当前版本是R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" ,但仍然收到类似的错误消息

UPDATE更新

STarted with : install.packages('caret', repos='http://cran.rstudio.com/') which displays message:开始于: 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’

and process ends with :过程结束于:

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

正如插入符号文档建议执行install.packages("caret", dependencies = c("Depends", "Suggests"))以确保安装所有需要的包并解决所有依赖项

I have similar issue when I installed caret package.当我安装插入符号包时,我遇到了类似的问题。 The problem I found was caused by updating package dependency.我发现的问题是由更新包依赖引起的。 Updating some packages will also change their dependency that may not have the right version for later use in other packages.更新一些包也会改变它们的依赖项,这些依赖项可能没有正确的版本供以后在其他包中使用。 Like when I install caret, it shown:就像我安装插入符号时一样,它显示:

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

The solution I found is to first find which package cause the problem.我找到的解决方案是首先找到导致问题的包。 You can get this information by just install the package you want.您只需安装所需的软件包即可获取此信息。 For me, the one is "minqa".对我来说,一个是“minqa”。 So just install this package independently.所以只需独立安装这个包。

install.packages("minqa")

My problem solved by this way.我的问题就这样解决了。

For you, you need to install "'minqa', 'RcppEigen', 'scales', 'lme4', 'ggplot2', 'reshape2', 'BradleyTerry2'" one by one.对于你,你需要一一安装“'minqa'、'RcppEigen'、'scales'、'lme4'、'ggplot2'、'reshape2'、'BradleyTerry2'”。

I faced similar dependencies issues while trying to install caret on R:我在尝试在 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)

I found that 'caret' didn't ask anymore for dependencies once I installed from OS an older 'car' version from R-car-2.0_21-1.8.x86_64.rpm package:我发现,一旦我从操作系统安装了来自 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!

Then:然后:

    > 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)

(*) I used a local repository 'cause there is not direct internet connection, but repo location is irrelevant. (*) 我使用了本地存储库,因为没有直接的互联网连接,但存储库位置无关紧要。

  • At Linux Mint 17.3 KDE "Rosa" (64 bit) , x86_64-pc-linux-gnu,在 Linux Mint 17.3 KDE“Rosa”(64 位)、x86_64-pc-linux-gnu、
  • After install R version 3.3.0 (2016-05-03) -- "Supposedly Educational".安装 R 版本 3.3.0 (2016-05-03) 后——“据称具有教育意义”。

I had similar problems with several packages (car, vegan, psych,...).我在几个包裹(汽车、素食、心理……)上遇到了类似的问题。 It was solved by running in the command line (Terminal):它是通过在命令行(终端)中运行来解决的:

sudo apt-get install r-base-dev

R

> install.packages("car")

Suerte!苏尔特!

I had a similar issue.我有一个类似的问题。 I used我用了

install.packages("caret", dependencies = c("Depends"), repos='http://cran.rstudio.com/')
and got并得到
ERROR: dependency 'car' is not available for package 'caret'
Installing car separately via R did not work but with package manager of my distro (Fedora)通过 R 单独安装汽车不起作用,但使用我的发行版(Fedora)的包管理器
dnf install R-car

Then the first command was successfull.那么第一个命令就成功了。

I had also similar issue with caret package installation.我也有插入符号包安装的类似问题。

I use Linux Mint 17.3 Cinnamon 64-bit:我使用 Linux Mint 17.3 Cinnamon 64 位:

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

First caret installation with the command使用命令进行第一个插入符号安装

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

gave the error messages as follows ...给出的错误信息如下...

* 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’

... ...

Then I tried to run然后我试着跑

install.packages("RcppEigen")

But it didn't work and gave same errors about llapack etc. Next I ran on the linux command line:但它不起作用,并给出了关于 llapack 等的相同错误。接下来我在 linux 命令行上运行:

sudo apt-get install liblapack-dev

(this install necessary libraries) (这会安装必要的库)

And after that the command然后命令

install.packages("RcppEigen") 

worked very well and so did also工作得很好,也是如此

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

So this liblapack-dev was answer to me.所以这个 liblapack-dev 是对我的回答。

Happy end and thanks for hints in this discussion!快乐的结局并感谢您在本次讨论中的提示!

I've had typical problem.我遇到了典型的问题。
When i was started to load dependencies packages i found error:当我开始加载依赖包时,我发现错误:
was installed by an R version with different internals

Reinstall these packages helped me重新安装这些软件包对我有帮助

我之前在 Linux 上安装过它,它可以工作:
sudo apt-get install -y r-cran-rcppeigen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM