【问题标题】:Dependency issue while installing caret package in R在 R 中安装插入符号包时的依赖性问题
【发布时间】:2015-02-13 05:04:41
【问题描述】:

我正在尝试安装 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

【问题讨论】:

  • 你换repos后试过了吗? IE。 install.packages('caret', repos='http://cran.rstudio.com/')
  • @arkun:是的,试过了,请检查更新
  • 如果是这种情况,我会先重新安装stringr,然后一个一个安装依赖项,如果不可用则更改repos,然后安装caret。顺便说一句,我也安装了pumpkin helmet 并安装了caret
  • @akrun: 你的 R 版本是多少?
  • 与您的版本相同 R 3.1.2caret_6.0-35, stringr_0.6.2

标签: r r-caret


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      【解决方案3】:
      • 在 Linux Mint 17.3 KDE “Rosa”(64 位),x86_64-pc-linux-gnu,
      • 安装 R 版本 3.3.0 (2016-05-03) 后 -- “据称具有教育意义”。

      我在使用几个包裹(汽车、素食、心理......)时遇到了类似的问题。通过在命令行(终端)中运行解决了:

      sudo apt-get install r-base-dev

      R

      > install.packages("car")

      苏尔特!

      【讨论】:

        【解决方案4】:

        caret 软件包安装也有类似的问题。

        我使用 Linux Mint 17.3 Cinnamon 64 位:

        • R 版本 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 是对我的回答。

        结束愉快,感谢本次讨论中的提示!

        【讨论】:

          【解决方案5】:

          我遇到了类似的问题。我用过

          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

          那么第一个命令就成功了。

          【讨论】:

            【解决方案6】:

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

            【讨论】:

            • 在 Fedora 25 上对我没有帮助。Sudoing 也没有帮助。有超过 50 条不可用依赖项的警告。
            • 我一直在尝试使用install_load() 进行安装,这解决了我的问题。
            【解决方案7】:

            我在尝试在 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)
            

            我发现从 OS 安装后,“caret”不再询问依赖项。 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)
            

            (*) 我使用的是本地存储库,因为没有直接的 Internet 连接,但存储库位置无关紧要。

            【讨论】:

              【解决方案8】:

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

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

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

              install.packages("minqa")
              

              我的问题就这样解决了。

              对你来说,需要一一安装“‘minqa’、‘RcppEigen’、‘scales’、‘lme4’、‘ggplot2’、‘reshape2’、‘BradleyTerry2’”。

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 2019-04-15
                • 1970-01-01
                • 2011-09-22
                • 1970-01-01
                • 2015-03-07
                相关资源
                最近更新 更多