【发布时间】:2019-10-28 08:31:48
【问题描述】:
目标:我想在 Windows 10 企业版上为 R 3.6.0 32 位安装
dssrip包。
我安装了 32 位和 64 位版本的 R 3.6.0。在 RStudio (1.2.1522) 中,我将默认版本设置为 32 位,然后使用 packrat 启用创建新项目。我在项目文件夹内的.Rprofile 文件中包含了以下几行。
#### -- Packrat Autoloader (version 0.5.0) -- ####
source("packrat/init.R")
#### -- End Packrat Autoloader -- ####
dir.create("packages", recursive = TRUE, showWarnings = FALSE)
.libPaths("./packages")
message("Using library: ", .libPaths()[1])
options(dss_jre_location="C:\\Program Files (x86)\\HEC\\HEC-DSSVue\\java")
Sys.setenv(JAVA_HOME="C:\\Program Files (x86)\\HEC\\HEC-DSSVue\\java")
安装:
install.packages(c("devtools", "rJava", "plyr", "reshape2", "stringr", "tidyverse"),
dependencies = TRUE)
library(rJava)
devtools::install_github("eheisman/DSS-Rip",
args = "--no-multiarch")
错误:
Installing package into ‘C:/Users/user007/Documents/ttn/R/Projects/dssrip/packages’
(as ‘lib’ is unspecified)
* installing *source* package 'dssrip' ...
** using staged installation
** R
** demo
** byte-compile and prepare package for lazy loading
Note: possible error in 'month(d, label = TRUE, ': unused arguments (label = TRUE, abbr = TRUE)
** help
*** installing help indices
converting help for package 'dssrip'
finding HTML links ... done
AF_PER_CFS_DAY html
dss_path_functions html
fixTimestamps html
getColumnsByName html
getDT html
getFullDT html
getFullTSC html
getLooseTSC html
getMetadata html
getTSC html
hydro_axis_trans html
hydrologic_date_functions html
initialize.dssrip html
model_error_measurement html
nash.sutcliffe html
opendss html
rmse html
tsc.to.dt html
tsc.to.xts html
weibullProbs html
xts.to.tsc html
** building package indices
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
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/user007/Documents/ttn/R/Projects/dssrip/packages/rJava/libs/x64/rJava.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
Error : package 'rJava' could not be loaded
Error: loading failed
Execution halted
ERROR: loading failed for 'x64'
* removing 'C:/Users/user007/Documents/ttn/R/Projects/dssrip/packages/dssrip'
Error in i.p(...) :
(converted from warning) installation of package
‘C:/Users/user007/AppData/Local/Temp/Rtmp8UP9Mb/file2d9c5e446300/dssrip_0.1.tar.gz’ had non-zero exit status
Java 版本:
C:\Program Files (x86)\HEC\HEC-DSSVue\java\bin>java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)
C:\Program Files (x86)\HEC\HEC-DSSVue\java\bin>java -d64
Unrecognized option: -d64
Could not create the Java virtual machine.
我尝试使用原生 R (C:\Program Files\R\R-3.6.0\bin\i386\Rgui.exe),但也没有用。
提前感谢您的任何指点!
【问题讨论】:
-
您的 Java 是 64 位还是 32 位?在我看来,您在安装
rJava时正在链接 64 位 java。 -
我看到你在你的
devtools::install_github电话中设置了--no-multiarch,但不是普遍的。您可以将 RStudio 配置为全局执行此操作(参考:support.rstudio.com/hc/en-us/articles/…),也许这会起作用? -
谢谢@r2evans!我明天试试
-
(1) 您必须在一个项目上工作才能进入Build > Configure Build Tools; (2) “项目构建工具”必须设置为“Package”才能看到设置“R CMD INSTALL附加选项”的选项。我有 RStudio1.2.1303 并在那里看到它。
-
谢谢@r2evans!我刚刚尝试过,但仍然遇到同样的错误
package 'rJava' is not installed for 'arch = x64'
标签: r package 32bit-64bit devtools dss