MOJO prediction gives exit status 127 - r

I created a MOJO file with H2O and try to predict based on the saved modell with R. However, I get an exit status 127 error and could not find any solution.
I have updated to the latest H2O release. The issues only occurs with Windows, running the code on Kaggle gives no error at all.
> modelpath <- h2o.download_mojo(fileh, path=getwd(), get_genmodel_jar=TRUE)
> modelpath
[1] "DeepLearning_model_R_1560926535628_2.zip"
> if(is.vector(X)) X <- t(X)
> X <- as.matrix(X)
> Ynew <- h2o.mojo_predict_df(frame = X, mojo_zip_path=modelpath, verbose=T)
...
input_csv: C:\Users\PAPERS~1\AppData\Local\Temp\Rtmpem4zDz/input.csv
mojo_zip:C:\Users\paperspace\Documents\DeepLearning_model_R_1560926535628_2.zip genmodel_jar: C:/Users/paperspace/Documents/h2o-genmodel.jar
output_csv: C:\Users\PAPERS~1\AppData\Local\Temp\Rtmpem4zDz/prediction.csv
classpath: C:/Users/paperspace/Documents/h2o-genmodel.jar
java_options: -Xmx4g -XX:ReservedCodeCacheSize=256m
java cmd: java -Xmx4g -XX:ReservedCodeCacheSize=256m -cp C:/Users/paperspace/Documents/h2o-genmodel.jar hex.genmodel.tools.PredictCsv --mojo C:\Users\paperspace\Documents\DeepLearning_model_R_1560926535628_2.zip --input C:\Users\PAPERS~1\AppData\Local\Temp\Rtmpem4zDz/input.csv --output C:\Users\PAPERS~1\AppData\Local\Temp\Rtmpem4zDz/prediction.csv --decimal
Fehler in h2o.mojo_predict_csv(input_csv_path = input_csv_path, mojo_zip_path = mojo_zip_path, :
SYSTEM COMMAND FAILED (exit status 127)
Zusätzlich: Warnmeldung:
In dir.create(tmp_dir) :
'C:\Users\PAPERS~1\AppData\Local\Temp\Rtmpem4zDz' existiert bereits

Related

How to solve ".jcall(conn#jc, "Ljava/sql/Statement;", "createStatement") : " error in R

I run a R code like this:
library(rugarch)
library(forecast)
library(blah blah blah)
set.seed(313)
config <- config::get(file = "/home/config.yml", use_parent = FALSE)
jdbcDriver = JDBC("oracle.jdbc.OracleDriver", classPath="ojdbc6.jar")
jdbcConnection = dbConnect(jdbcDriver, config$url, config$dbuser, config$dbpass)
I get below error:
Error in .jcall(conn#jc, "Ljava/sql/Statement;", "createStatement") :
RcallMethod: attempt to call a method of a NULL object.
I use:
R version 3.6.3 (2020-02-29)
Linux "Ubuntu" VERSION="20.04 LTS (Focal Fossa)"
I run the R in a docker container.
How can I solve the problem?

My testthat tests pass the devtools::test() check but fail the devtools::check() step when developing an R package

I have 3 rds files I use in my testthat tests. the files are in /tests/testthat/testdata/. When I run the tests with devtools::test(), the files can be found. When I use devtools::check(), the files won't be found.
I have seen this issue discussed here and here and many other places but all the suggested solutions won't work for me.
I tried adding the Sys.setenv(R_TESTS="") line at the top of my "testthat.R" file; I tried using here::here() from the package "here" instead of the , system.file() function, etc.
What can I do?
Here is my test:
test_that("the test_arguments() returns errors as it should", {
x <- readRDS(system.file("tests", "testthat", "testdata", "objectA.rds", package = "package"))
y <- readRDS(system.file("tests", "testthat", "testdata", "objectB.rds", package = "package"))
z <- readRDS(here::here("tests", "testthat", "testdata", "objectC.rds", package = "package"))
expect_error(test_arguments(z, y), "X has to be an object of class SpatialPolygonsDataFrame")
expect_error(test_arguments(x, z), "y has to be an object of class RasterLayer")
})
And here is the result of the devtools::check():
-- Error (test_user_input.R:3:3): the arguments are of the right class ---------------------
Error: cannot open the connection
Backtrace:
x
1. \-base::readRDS(here::here("tests", "testthat", "testdata", "objectA.rds")) test_user_input.R:3:2
2. \-base::gzfile(file, "rb")
[ FAIL 1 | WARN 1 | SKIP 0 | PASS 0 ]
Error: Test failures
Execution halted
1 error x | 1 warning x | 1 note x

Error running Rmpi when doing parallel computing

I'm trying to running parallel computing in R with below lines
library(parallel)
library(snow)
library(snowFT)
library(VGAM)
library(dplyr)
library(Rmpi)
nCores <- detectCores() - 1
cl <- makeCluster(nCores)
Then R returns an error
Error in Rmpi::mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count, : Internal MPI error!, error stack: MPI_Comm_spawn(cmd="C:/R/R-40~1.2/bin/x64/Rscript.exe", argv=0x00000223DB137530, maxprocs=11, MPI_INFO_NULL, root=0, MPI_COMM_SELF, intercomm=0x00000223DCFCD998, errors=0x00000223DA9FC9E8) failed Internal MPI error! FAILspawn not supported without process manager
3. Rmpi::mpi.comm.spawn(slave = mpitask, slavearg = args, nslaves = count, intercomm = intercomm)
2. makeMPIcluster(spec, ...)
1. makeCluster(nCores)
I've tried to install MPICH2 on Windows from here, but the final cmd command mpiexec -validate always returns FAIL.
Could you please elaborate on how to solve this issue?
The problem is that makeCluster(nCores) is used by more than one package. As such, I use parallel::makeCluster(nCores) to solve the issue.

Recommenderlab running into memory issues

I am trying to compare some recommender algorithms against each other but am running into some memory issues. The dataset that i am using is https://drive.google.com/open?id=0By5yrncwiz_VZUpiak5Hc2l3dkE
Following is my code:
library(recommenderlab)
library(Matrix)
Amazon <- read.csv(Path to Reviews.csv, header = TRUE,
col.names = c("ID","ProductId","UserId","HelpfulnessNumerator","HelpfulnessDenominator","Score",
"Time","Summary","Text"),
colClasses = c("NULL","character","character","NULL","NULL","integer","NULL","NULL","NULL"))
Amazon <- Amazon[,c("UserId","ProductId","Score")]
Amazon <- Amazon[!duplicated(Amazon[1:2]),] ## To get unique values
scheme <- evaluationScheme(r, method = "split", train = .7,
k = 1, given = 1 ,goodRating = 4)
algorithms <- list(
"user-based CF" = list(name="UBCF", param=list(normalize = "Z-score",
method="Cosine",
nn=50, minRating=3)),
"item-based CF" = list(name="IBCF", param=list(normalize = "Z-score"
))
)
results <- evaluate(scheme, algorithms, n=c(1, 3, 5))
I get the following errors :
UBCF run fold/sample [model time/prediction time]
1 Timing stopped at: 1.88 0 1.87
Error in asMethod(object) :
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105
IBCF run fold/sample [model time/prediction time]
1 Timing stopped at: 4.93 0.02 4.95
Error in asMethod(object) :
Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105
Warning message:
In .local(x, method, ...) :
Recommender 'user-based CF' has failed and has been removed from the results!
Recommender 'item-based CF' has failed and has been removed from the results!
I tried to use recommenderlabrats package which i thought would solve this problem but could not install it. https://github.com/sanealytics/recommenderlabrats
It gave me some errors which i am not bale to make sense of:
c:/rbuildtools/3.3/gcc-4.6.3/bin/../lib/gcc/i686-w64- mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -llapack
collect2: ld returned 1 exit status
Then i came to this link for solving the recommenderlabrats problem but it did not work for me
Error while installing package from github in R. Error in dyn.load
Any help on how to get around the memory issue is appreciated
I am the author of recommenderlabrats. Try to install now, it should be fixed. Then use RSVD/ALS to solve. Your matrix is too big even when it's sparse for your computer.
Also, it might be a good idea to experiment with a smaller sample before spending on an AWS memory instance.

R - Testing an installation

I am new to R. I have just installed R 3.2.2, and RStudio 0.99, under Windows 8.
As per section 3.2 Testing an Installation of Help contents,
I meant to execute the following 5 lines of commands.
Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en")
library("tools")
testInstalledBasic("both")
testInstalledPackages(scope = "base", errorsAreFatal = FALSE)
testInstalledPackages(scope = "recommended", errorsAreFatal = FALSE)
The first 2 worked fine. The third threw an error, as shown here
> Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en")
> library("tools")
> testInstalledBasic("both")
running strict specific tests
running code in ‘eval-etc.R’
unable to open output file
FAILED
[1] 1
Warning message:
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD BATCH --vanilla --no-timing "eval-etc.R" "eval-etc.Rout"' had status 2
>
What is the problem?
Could it be related to setting directories/permissions?
You seem to be missing the diff file from Rtools in the test folder. Simply copying/pasting should do the trick.

Resources