e-kotov / rJavaEnv

Java Environments for R Projects
http://www.ekotov.pro/rJavaEnv/
Other
7 stars 0 forks source link

test on vanilla OS installs #15

Open e-kotov opened 2 days ago

e-kotov commented 2 days ago

Test {rJavaEnv} on vanilla systems running:

e-kotov commented 2 days ago

Test report for macOS (Apple Silicon/aarch64/ARM) (with pre-build R package binaries)

System:

sw_vers
#> ProductName: macOS
#> ProductVersion: 14.5
#> BuildVersion: 23F79

uname -m
#> arm64

Test sequence:

1. Install Homebrew from https://brew.sh/

2. Install R and RStudio casks

brew install --cask r
brew install --cask rstudio

3. Check if there is Java in vanilla macOS

which java
#> /usr/bin/java

java --version
#> The operation couldn't be completed. Unable to locate a Java Runtime.
#> Please visit http://www.java.com for information on installing Java.

4. Run RStudio

5. Install {r5r} and {remotes}, then {rJavaEnv}

install.packages(c("remotes","r5r"))
remotes::install_github("e-kotov/rJavaEnv")

6. Check if Java dependent package is working

library(rJavaEnv)
java_quick_install(21)
java_check_version_rjava()

library(r5r)

# build transport network
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path)

# load origin/destination points
points <- read.csv(file.path(data_path, "poa_points_of_interest.csv"))

departure_datetime <- as.POSIXct(
  "13-05-2019 14:00:00",
  format = "%d-%m-%Y %H:%M:%S"
)

ttm <- travel_time_matrix(
  r5r_core,
  origins = points,
  destinations = points,
  mode = c("WALK", "TRANSIT"),
  departure_datetime = departure_datetime,
  max_trip_duration = 60
)
head(ttm)

Verdict

{rJavaEnv} package works as expected. Even without any Java installed on vanilla system, the package is able to successfully install Java and set it up in the R project/working directory. The dependent package {r5r} is able to run without any issues.

Caveat

This is tested with CRAN version of R that downloads precompiled binaries of packages. If the {rJava} package needs to be compiled from source (e.g. for R installed using brew install r), it will require Java to be installed before installing {rJava} and {r5r} or other {rJava}-dependent package.

e-kotov commented 2 days ago

Test report for macOS (Apple Silicon/aarch64/ARM) (with R packages installed from source)

System:

sw_vers
#> ProductName: macOS
#> ProductVersion: 14.5
#> BuildVersion: 23F79

uname -m
#> arm64

Test sequence:

1. Install Homebrew from https://brew.sh/

2. Install R and RStudio

brew install r
brew install --cask rstudio

3. Check if there is Java in vanilla macOS

which java
#> /usr/bin/java

java --version
#> The operation couldn't be completed. Unable to locate a Java Runtime.
#> Please visit http://www.java.com for information on installing Java.

4. Run RStudio

5. Check if {rJava} can be installed with Java installed using {rJavaEnv}

install.packages("remotes")
remotes::install_github("e-kotov/rJavaEnv")
library(rJavaEnv)
java_quick_install(21)
java_check_version_cmd()

install.packages("rJava")

results in:

configure: error: Java Development Kit (JDK) is missing or not registered in R Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package 'rJava'
* removing "/opt/homebrew/lib/R/4.4/site-library/rJava'
Warning in install.packages :
installation of package "rJava' had non-zero exit status

6. Try javareconf

In Terminal, without admin rights:

export JAVA_HOME=/Users/user/Library/Caches/org.R-project.R/R/rJavaEnv/installed/macos/aarch64/21
R CMD javareconf -e
install.packages("rJava")

Fails.

In Terminal, with admin rights:

export JAVA_HOME=/Users/user/Library/Caches/org.R-project.R/R/rJavaEnv/installed/macos/aarch64/21
R CMD javareconf
install.packages("rJava")

Succeeds! {rJava} is built from source!

Verdict

Overall, {rJavaEnv} package works as expected, but some manual actions are still required from the user. Specifically, the user needs to close R/RStudio and run two commands in the terminal with admin privileges to reconfigure Java.

e-kotov commented 2 days ago

Test report for Windows (ARM/Intel)

There is no official stable R or RStudio for Windows for ARM processors, so I am testing x64 R and RStudio in Windows for ARM preview with x64 emulation.

System:

winver

#> Microsoft Windows
#> Version 23H2 (OS Build 22631,2861)

cmd c /ver
#> Microsoft Windows [Version 10.0.22631.2861]

systeminfo | findstr /C:"System Type"
#> System Type:               ARM64-based PC

Test sequence:

1. Install R and RStudio manually using respective installers

2. Check if there is Java in vanilla Windows

java --version
#>'java' is not recognized as an internal or external command,
operable program or batch file.

3. Run RStudio

4. Install {r5r} and {remotes}, then {rJavaEnv}

install.packages(c("remotes","r5r"))
remotes::install_github("e-kotov/rJavaEnv")

6. Check if Java dependent package is working

library(rJavaEnv)
java_quick_install(21)
java_check_version_rjava()

library(r5r)

# build transport network
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path)

# load origin/destination points
points <- read.csv(file.path(data_path, "poa_points_of_interest.csv"))

departure_datetime <- as.POSIXct(
  "13-05-2019 14:00:00",
  format = "%d-%m-%Y %H:%M:%S"
)

ttm <- travel_time_matrix(
  r5r_core,
  origins = points,
  destinations = points,
  mode = c("WALK", "TRANSIT"),
  departure_datetime = departure_datetime,
  max_trip_duration = 60
)
head(ttm)

Verdict

Caveats