无法加载包 - 已尝试所有依赖项

时间:2018-03-26 19:24:01

标签: r rjava

我似乎找不到解决此错误的方法:

> install.packages("devtools")
Installing package into ‘C:/Users/rawlingsD/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘memoise’, ‘git2r’

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/memoise_1.1.0.zip'
Content type 'application/zip' length 29955 bytes (29 KB)
downloaded 29 KB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/git2r_0.21.0.zip'
Content type 'application/zip' length 3029324 bytes (2.9 MB)
downloaded 2.9 MB

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/devtools_1.13.5.zip'
Content type 'application/zip' length 443954 bytes (433 KB)
downloaded 433 KB

package ‘memoise’ successfully unpacked and MD5 sums checked
package ‘git2r’ successfully unpacked and MD5 sums checked
package ‘devtools’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\rawlingsD\AppData\Local\Temp\Rtmpag2PO3\downloaded_packages
> devtools::install_github("kassambara/r2excel")
Downloading GitHub repo kassambara/r2excel@master
from URL https://api.github.com/repos/kassambara/r2excel/zipball/master
Installing r2excel
"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  "C:/Users/rawlingsD/AppData/Local/Temp/Rtmpag2PO3/devtools232469f6118a/kassambara-r2excel-4144fc5"  \
  --library="C:/Users/rawlingsD/Documents/R/win-library/3.4" --install-tests 

* installing *source* package 'r2excel' ...
** R
** preparing package for lazy loading
Error: package or namespace load failed for 'rJava':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: JAVA_HOME cannot be determined from the Registry
Error : package 'rJava' could not be loaded
ERROR: lazy loading failed for package 'r2excel'
* removing 'C:/Users/rawlingsD/Documents/R/win-library/3.4/r2excel'
In R CMD INSTALL

我已经尝试单独加载rJava,这似乎导致了这个问题,我已经从rStudio的tar.gz文件以及直接从CRAN安装,但是,它们都没有工作!

提前感谢您的帮助!

在重新下载Java x64并试用该行之后仍未解决:

Sys.setenv(JAVA_HOME="C://Program Files//Java//jre1.8.0_161")

这些是关于另一个问题的建议,我使用的是Windows 10并且出现以下错误:

Error: package or namespace load failed for 'rJava':
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 'C:/Users/rawlingsD/Documents/R/win-library/3.4/rJava/libs/i386/rJava.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.

再次感谢您的帮助

1 个答案:

答案 0 :(得分:0)

问题更可能是32位与64位java安装在您的计算机上。卸载java并安装特定的位版本(64位更好)。然后安装xlsx,rJava等。

相关问题