3

Goal: I want to install dssrip package for R 3.6.0 32-bit on Windows 10 Enterprise.

I have both 32- and 64-bit versions of R 3.6.0 installed. In RStudio (1.2.1522), I set the default version to 32-bit then create new project with packrat enable. I included the following lines in the .Rprofile file inside project folder.

#### -- 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")

Installation:

install.packages(c("devtools", "rJava", "plyr", "reshape2", "stringr", "tidyverse"),
                 dependencies = TRUE)
library(rJava)
devtools::install_github("eheisman/DSS-Rip",
                         args = "--no-multiarch")

Error:

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 version:

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.

I tried using the native R (C:\Program Files\R\R-3.6.0\bin\i386\Rgui.exe) but it did not help either.

Thanks in advance for any pointer!

Tung
  • 26,371
  • 7
  • 91
  • 115
  • Is your Java 64 or 32 bit? It seems to me that you are linking the 64-bit java when installing `rJava`. – nicola Jun 25 '19 at 10:50
  • My Java is 32-bit. Thanks! – Tung Jun 25 '19 at 13:17
  • 1
    I see you set `--no-multiarch` in your `devtools::install_github` call, but not universally. You can configure RStudio to do this globally (ref: https://support.rstudio.com/hc/en-us/articles/200486518-Customizing-Package-Build-Options), perhaps that will work? – r2evans Jun 26 '19 at 00:27
  • 1
    Thanks @r2evans! I'll try it tomorrow – Tung Jun 26 '19 at 20:33
  • @r2evans: I couldn't find that option in the new RStudio anymore. Maybe they removed it already? – Tung Jul 01 '19 at 19:27
  • 1
    (1) You must be working on a project in order to get to *Build > Configure Build Tools*; (2) the *"Project build tools"* must be set "Package" in order to see the options for setting "R CMD INSTALL additional options". I have RStudio1.2.1303 and see it there. – r2evans Jul 01 '19 at 20:05
  • 1
    Thanks @r2evans! I've just tried that but still encountered the same error `package 'rJava' is not installed for 'arch = x64'` – Tung Jul 01 '19 at 20:28

2 Answers2

1

Update 2: dssrip has been updated to work with 64-bit and . You will need a 64-bit compatible version of HEC-DSSVue (e.g., v3.2.3).

Update: I had to uninstall and delete everything and started from scratch to make dssrip work.

Put the following lines in the .Rprofile file:

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 all dependencies:

install.packages(c("remotes", "rJava", "data.table", "plyr", "reshape2", "stringr", "tidyverse"),
                 dependencies = TRUE)

Note that to force R to install only 32-bit version, I had to use this syntax instead:

remotes::install_github("eheisman/dssrip",
                         INSTALL_opts = "--no-multiarch")
Tung
  • 26,371
  • 7
  • 91
  • 115
0

Have you tried using RStudio -> Tool -> General, then click on "change" button on top that allows you to change the R-Version. A pull-down menu opens where you can select the 32-bit Version and activate it. You will have to restart RStudio to make it happen, though.

dullibri
  • 1
  • 1
  • OK, sorry, I did not understand when I read that first though reading it the second time it is clear, that you did that. – dullibri Jun 28 '19 at 12:07