首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我在安装R包时遇到了问题。每当我尝试安装时,都会收到非零状态的错误消息。原因何在?

我在安装R包时遇到了问题。每当我尝试安装时,都会收到非零状态的错误消息。原因何在?
EN

Stack Overflow用户
提问于 2021-01-20 14:31:52
回答 1查看 114关注 0票数 0

我试着安装rethinking包。但是,我无法安装该程序包。每当我安装时,R都会下载软件包,但由于某种原因无法安装。我甚至尝试了包的直接网站,但我最终还是遇到了同样的问题。我还尝试了另一个包,"timetk“。然而,我也面临着同样的错误。让我知道问题所在。谢谢。

代码:

#1.

代码语言:javascript
复制
devtools::install_github("rmcelreath/rethinking")
Downloading GitHub repo rmcelreath/rethinking@HEAD
√  checking for file 'C:\Users\bondb\AppData\Local\Temp\Rtmp2T4bd5\remotes1e442e155feb\rmcelreath-rethinking-3b48ec8/DESCRIPTION' (557ms)
-  preparing 'rethinking': (505ms)
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  looking to see if a 'data/datalist' file should be added
-  building 'rethinking_2.13.tar.gz' (438ms)
   
Installing package into ‘C:/Users/bondb/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'rethinking' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'rethinking'
    finding HTML links ... done
    AMTL                                    html  
    Achehunting                             html  
    Boxes                                   html  
    Crofoot                                 html  
    Dinosaurs                               html  
    Dissertations                           html  
    Fish                                    html  
    HMC2                                    html  
    HPDI                                    html  
    finding level-2 HTML links ...
Error: unknown input format
* removing 'C:/Users/bondb/R/win-library/4.0/rethinking'
Error: Failed to install 'rethinking' from GitHub:
  (converted from warning) installation of package ‘C:/Users/bondb/AppData/Local/Temp/Rtmp2T4bd5/file1e44343fd58/rethinking_2.13.tar.gz’ had non-zero exit status

#2.

代码语言:javascript
复制
install_github("https://github.com/rmcelreath/rethinking/releases/tag/2.13", force = T)
Downloading GitHub repo rmcelreath/rethinking@2.13
√  checking for file 'C:\Users\bondb\AppData\Local\Temp\Rtmp2T4bd5\remotes1e44223e4eb1\rmcelreath-rethinking-3b48ec8/DESCRIPTION' (511ms)
-  preparing 'rethinking': (549ms)
√  checking DESCRIPTION meta-information ... 
-  checking for LF line-endings in source and make files and shell scripts (416ms)
-  checking for empty or unneeded directories
-  looking to see if a 'data/datalist' file should be added
-  building 'rethinking_2.13.tar.gz' (523ms)
   
Installing package into ‘C:/Users/bondb/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'rethinking' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'rethinking'
    finding HTML links ... done
    AMTL                                    html  
    Achehunting                             html  
    Boxes                                   html  
    Crofoot                                 html  
    Dinosaurs                               html  
    Dissertations                           html  
    Fish                                    html  
    HMC2                                    html  
    HPDI                                    html  
    finding level-2 HTML links ...
Error: unknown input format
* removing 'C:/Users/bondb/R/win-library/4.0/rethinking'
Error: Failed to install 'rethinking' from GitHub:
  (converted from warning) installation of package ‘C:/Users/bondb/AppData/Local/Temp/Rtmp2T4bd5/file1e44327c130/rethinking_2.13.tar.gz’ had non-zero exit status

#3.

代码语言:javascript
复制
install.packages("timetk")
Installing package into ‘C:/Users/bondb/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
  unable to access index for repository http://xcelab.net/R/bin/windows/contrib/4.0:
  cannot open URL 'http://xcelab.net/R/bin/windows/contrib/4.0/PACKAGES'

  There is a binary version available but the source version is later:
       binary source needs_compilation
timetk  2.6.0  2.6.1             FALSE

installing the source package ‘timetk’

trying URL 'https://cran.rstudio.com/src/contrib/timetk_2.6.1.tar.gz'
Content type 'application/x-gzip' length 3793775 bytes (3.6 MB)
downloaded 3.6 MB

* installing *source* package 'timetk' ...
** package 'timetk' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'timetk'
    finding HTML links ... done
    between_time                            html  
    bike_sharing_daily                      html  
    box_cox_vec                             html  
    condense_period                         html  
    diff_vec                                html  
    filter_by_time                          html  
    filter_period                           html  
    fourier_vec                             html  
    future_frame                            html  
    is_date_class                           html  
    lag_vec                                 html  
    log_interval_vec                        html  
    m4_daily                                html  
    m4_hourly                               html  
    m4_monthly                              html  
    m4_quarterly                            html  
    m4_weekly                               html  
    m4_yearly                               html  
    mutate_by_time                          html  
    normalize_vec                           html  
    pad_by_time                             html  
    parse_date2                             html  
    finding level-2 HTML links ...
Error: unknown input format
* removing 'C:/Users/bondb/R/win-library/4.0/timetk'
Warning in install.packages :
  installation of package ‘timetk’ had non-zero exit status
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-21 04:45:24

当您看到消息"finding level-2HTML links...“时,包构建器正在运行tools::findHTMLlinks(level=2)来查找帮助文件之间的链接。通常,链接信息作为RDS文件缓存在包中。下面是函数运行的代码变体,您可以运行该函数来检查错误可能来自何处

代码语言:javascript
复制
check_rds <- function(rds) {tryCatch({readRDS(rds); TRUE}, error=function(x) {FALSE})}

for (x in rev(dir(.libPaths(), full.names = TRUE))) {
  is_ok <- if (file_test("-f", f <- file.path(x, "Meta", "links.rds")))
    check_rds(f)
  else if (file_test("-f", f <- file.path(x, "Meta", "Rd.rds")))
    check_rds(f)
  else TRUE
  if (!is_ok) {
    print(paste("bad file", x, f)); 
  }
}

它应该打印出它找到的所有坏的RDS文件。如果未打印任何内容,则错误一定在其他地方。但是如果它确实发现了一个坏文件,那么我建议卸载那个特定的包,然后重新安装它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65804198

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档