在一台运行R 2.15.2的计算机上,我已经从.zip文件安装了软件包(这些软件包碰巧是ggplot2和data.table,但是我不认为特定的软件包是我的问题。)一切正常。我将这些程序包带到没有Internet连接的计算机上并安装了它们。这台其他计算机正在运行R 3.0.1。这些软件包的安装似乎没有问题(使用R的“从本地zip文件安装软件包”选项)。当我使用library()调用程序包时,出现以下错误:
Error: package '<insert name of newly installed package here>' was build before 3.0.0: please-re-install it
有人可以解释引发此错误的潜在原因吗? .zip软件包是否必须包含特定目录才能正确安装?如果将R安装在加载.zip软件包的单独分区上,这会导致错误吗?
我不知所措,非常感谢任何指针。这是很难复制的。如果您需要任何其他版本/系统参数来了解此问题,请随时询问。
运行install.packages("codetools")
可以解决R 3.0.2的这个问题,如果您遇到和我一样的问题:
installing to /home/user/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/libs
** R
** inst
** preparing package for lazy loading
Error : package ‘**codetools**’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘Rcpp’
ERROR: lazy loading failed for package ‘Rcpp’
我在查看GitHub ggplot2 issue #796时发现了此解决方案
update.packages(checkBuilt = TRUE, ask = FALSE)
它将更新所有需要重新安装的软件包。
我根据https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions安装了闪亮的灯>
并且在步骤中出现相同的错误
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\"" Warning messages: 1: In install.packages("shiny", repos = "http://cran.rstudio.com/") : installation of package ‘Rcpp’ had non-zero exit status 2: In install.packages("shiny", repos = "http://cran.rstudio.com/") : installation of package ‘httpuv’ had non-zero exit status 3: In install.packages("shiny", repos = "http://cran.rstudio.com/") : installation of package ‘shiny’ had non-zero exit status
我以R开头尝试了Richard Lee的答案
R
并得到错误
Warning in install.packages("shiny") : 'lib = "/usr/local/lib/R/site-library"' is not writable Would you like to use a personal library instead? (y/n) n Error in install.packages("shiny") : unable to install packages
显然没有写权限,所以
sudo R
现在我再试一次
install.packages("shiny")
并且有很多错误
Error : package ‘codetools’ was built before R 3.0.0: please re-install it Error : package ‘RJSONIO’ was built before R 3.0.0: please re-install it Error : package ‘caTools’ was built before R 3.0.0: please re-install it Error : package ‘bitops’ was built before R 3.0.0: please re-install it Error : package ‘digest’ was built before R 3.0.0: please re-install it Error : package ‘xtable’ was built before R 3.0.0: please re-install it
每次遇到错误,我都会重新安装所需的软件包
install.packages("codetools") install.packages("RJSONIO") etc.
并且最终,我能够安装Rccp,httpuv甚至是Shiny。现在可以了!!
也请参见Shiny package installation on R version 3.0.2 "Frisbee Sailing"
我正在精确地使用rkward
[我试图在Ubuntu 12.04LTS的R(v3.1.0)上安装swir:
这是我使用的解决方法: