launching renv::activate() with RMarkdown causes R to crash - r

I have a r-markdown chunk with this command line:
renv::activate(file.path(proj_root, "my_folder"))
When I run this line alone in the console or with ctrl+enter, it works perfectly.
But when I try the Run current chunk or Run all chunks above buttons, R session fails (I do not have more precise error message).
Here are my R specifs:
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.1 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=fr_FR.UTF-8 LC_COLLATE=fr_FR.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=fr_FR.UTF-8 LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3
Last time, I changed Ubuntu's system language from French to English, can it have something to do ?
Thanks for your ideas.

Related

R shiny: read ECONNRESET Error randomly occurs

Almost the time the app works find but the error occurs randomly, and I cannot find the error trace in the apps log(/var/log/shiny-server):
An error has occurred
The application exited unexpectedly.
read ECONNRESET
The sessionInfo() is as below:
R version 3.4.3 (2017-11-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux buster/sid
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3
And there's not much info about this issue with R shiny app, maybe it's about node.js?
Thanks for any advise in advance.
Finally I solved it by adding below code in server.r
onStop(function() {
odbcClose(conn)
})
I query data from database frequently but I did not close it.
After adding the code to close connection the error seldom occurs.
And I also adjust the app_idle_timeout to 0 in the /etc/shiny-server/shiny-server.conf

R BiocManager::install() fails to read temp files

I am trying to install some packages (quite basic ones actually) for R 3.6, but I'm getting a fairly strange error message from BiocManager::install():
BiocManager::install("XML", destdir = "/my/dir/R/x86_64-pc-linux-gnu-library/3.6/")
error: could not load shared object '/my/dir/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-XML/00new/XML/libs/XML.so':
libicui18n.so.58: Could not open shared object file: No such file or directory
(Translated from french - could be approximate)
Does this mean that R can't write in /my/dir/R/x86_64-pc-linux-gnu-library/3.6/? That would be my first idea but I really don't know.
EDIT:
Here is my session info:
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
locale:
[1] LC_CTYPE=fr_FR.UTF-8 LC_NUMERIC=C LC_TIME=C
[4] LC_COLLATE=fr_FR.UTF-8 LC_MONETARY=C LC_MESSAGES=fr_FR.UTF-8
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] BiocManager_1.30.10
loaded via a namespace (and not attached):
[1] compiler_3.6.2 tools_3.6.2
This is a configuration problem, there is a fix available at github.com/r-lib/xml2/issues/219.

R: memory limit error while running R on cluster

I have a memory issue with R.
I'm running a big and complex analysis on R installed via anaconda in my home on a cluster from my institution. I created my environment so that I can install packages without problems. While running the following error occurs:
Error: cannot allocate vector of size 26.7 Gb
I checked the memory limit by typing memory.limit() but it appears to be Inf.
This is the output of my sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /home/user/miniconda3/envs/py37/lib/libopenblasp-r0.3.7.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1
While running the tool responsible for the problem I performed ssh to a single node with 24 cores to allow the pipeline to run.
Can anyone help me to solve this problem? Thank you in advance!

Using parLapply with data.table's rbindlist causes CPU to go over 100%

Consider the following code block:
library(data.table)
library(parallel)
random_function<-function(i){
n<-1000000
big_list<-list("vector")
for (k in 1:100){
big_list[[k]]<-data.table(rnorm(n),rnorm(n))
}
rbindlist(big_list,use.names = TRUE,fill=TRUE)
}
cl<-makeCluster(8)
clusterExport(cl,"random_function")
clusterCall(cl,function()library(data.table))
parLapply(cl,1:1000,random_function)
stopCluster(cl)
When I run it on my machine, which has 36 threads suddenly all the threads are being activated (i.e., the 8 ones which I specified when creating cluster exceed 100% load).
This only happens with data.table 1.12.0. Everything works perfectly with data.table_1.11.8. Is this a bug or I am just doing something wrongly? It seems that the problem is within rbindlist, i.e., if I do not put within a function rbindlist there is no more than 100% load on my 8 threads.
Here is my session info:
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.12.0
loaded via a namespace (and not attached):
[1] compiler_3.5.2 tools_3.5.2

Cannot install Monet DB Lite for R Ubuntu 17.10

I try running:
install.packages("MonetDBLite")
in R. However, I get the following error:
cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]
cc1: some warnings being treated as errors
Makevars:194: recipe for target 'build/objects/monetdblite/common/stream.o' failed
make: *** [build/objects/monetdblite/common/stream.o] Error 1
ERROR: compilation failed for package ‘MonetDBLite’
Does anyone know why this isn't working?
Output from sessionInfo() below:
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.10
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2 yaml_2.1.15
This should be resolved with the latest version of MonetDBLite on CRAN, 0.5.1.

Resources