Error: memory exhausted (limit reached?) - r

Does any one know how to resolve this error ? I am using R in macbook pro.
I am using a clustering package calld rsgcc
thm <- gcc.tsheatmap(b[2:5264,], cpus = 1, cormethod = "GCC", distancemethod = "Raw", clustermethod = "complete")
Dimension information for clustered GE matrix: 5263 9
R(18015,0xac5c3a28) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
R(18015,0xac5c3a28) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
R(18015,0xac5c3a28) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
Error: memory exhausted (limit reached?)
My session Info is
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
locale:
[1] C/UTF-8/C/C/C/C
attached base packages:
[1] stats graphics grDevices utils datasets methods base

Like #arun commented, you need to start using 64 bit R to be able to use the full potential of the 16 gigabytes o of RAM you have. Right now, R can use about 3 gb...

Related

Error: package or namespace load failed for 'treesnip'

When trying to install the treesnip package from github using remotes::install_github("curso-r/treesnip"), I get the following error:
remotes::install_github("curso-r/treesnip")
Downloading GitHub repo curso-r/treesnip#HEAD
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
√ checking for file 'C:\Users\SAR.V-LOG\AppData\Local\Temp\RtmpENiM7Q\remotes38701dfb49f3\curso-r-treesnip-c70a89b/DESCRIPTION' (375ms)
- preparing 'treesnip': (736ms)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
Removed empty directory 'treesnip/.github/workflows'
Removed empty directory 'treesnip/.github'
NB: this package now depends on R (>= 3.5.0)
WARNING: Added dependency on R >= 3.5.0 because serialized objects in serialize/load version 3 cannot be read in older versions of R. File(s) containing such objects: 'treesnip/inst/benchmark_parallel_processing_vignette.rds'
- building 'treesnip_0.1.0.tar.gz'
* installing *source* package 'treesnip' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'treesnip'
finding HTML links ... done
add_boost_tree_catboost html
add_boost_tree_lightgbm html
add_decision_tree_tree html
multi_predict._catboost.Model html
multi_predict._lgb.Booster html
predict_lightgbm_classification_class html
predict_lightgbm_classification_prob html
predict_lightgbm_classification_raw html
predict_lightgbm_regression_numeric html
train_catboost html
train_lightgbm html
train_tree html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'treesnip':
.onLoad failed in loadNamespace() for 'treesnip', details:
call: NULL
error: The values passed to `set_encoding()` are missing arguments: 'allow_sparse_x'
error: loading failed
running stopped
*** arch - x64
Error: package or namespace load failed for 'treesnip':
.onLoad failed in loadNamespace() for 'treesnip', details:
call: NULL
error: The values passed to `set_encoding()` are missing arguments: 'allow_sparse_x'
Fejl: loading failed
running stopped
ERROR: loading failed for 'i386', 'x64'
* removing 'C:/Users/SAR.V-LOG/OneDrive - VELUX/Documents 1/R/R-4.0.2/library/treesnip'
Error: Failed to install 'treesnip' from GitHub:
(converted from warning) installation of package ‘C:/Users/SAR~1.V-L/AppData/Local/Temp/RtmpENiM7Q/file38706c2c7239/treesnip_0.1.0.tar.gz’ had non-zero exit status
my sessionInfo():
sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=Danish_Denmark.1252 LC_CTYPE=Danish_Denmark.1252 LC_MONETARY=Danish_Denmark.1252
[4] LC_NUMERIC=C LC_TIME=Danish_Denmark.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2
I works fine when running on another PC.
I also tried changing the library location to C:/Users/SAR.V-LOG/, but that didn't help either.
Further I tried to provide INSTALL_opts = "--no-test-load". When I do that the installation finished wihtout errors, but when I try to load the library using library(treesnip) I get the same error: The values passed to set_encoding() are missing arguments: 'allow_sparse_x'
Do you know what is causing this error and how I can fix it?
treesnip is fixed. It now depends on parsnip (>= 0.1.3.9000) https://github.com/curso-r/treesnip/commit/902a33d9f156c10da6dbe1bd9cccb65926077197
Try using parsnip 0.1.3 (not the development version in this case). It looks like 0.1.3.9000 has some breaking changes coming that will be handled in a new version of parsnip-adjacent packages.
The warning message indicates:
Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
You may need to upgrade your Rtools, which can be done here: https://cran.r-project.org/bin/windows/Rtools/
Let me know if this fixes your problem.
Also I have added a GitHub Issue Here: https://github.com/tidymodels/parsnip/issues/376

Capture R output when running Rcmd.exe

I have a line of code to capture the output of the version of Java installed:
version <- system2("java","-version", stdout=TRUE)
However, if I include that line of code when creating a package in the .onLoad function, I run into a problem when building.
.onLoad <- function(libname, pkgname){
version <- system2("java","-version", stdout=TRUE)
if(length(version)==0){
stop("Missing version")
}
}
Using the default RStudio "Clean and Rebuild", I can see both that the output is shown in the command line (the Java parts), and that the code then has the error showing the output was length 0:
==> Rcmd.exe INSTALL --preclean --no-multiarch --with-keep.source testpackage
* installing to library 'C:/Users/JNolis2/Documents/R/win-library/3.5'
* installing source package 'testpackage' ...
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'testpackage'
finding HTML links ... hello html
done
** building package indices
** testing if installed package can be loaded
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
Error: package or namespace load failed for 'testpackage':
.onLoad failed in loadNamespace() for 'testpackage', details:
call: fun(libname, pkgname)
error: Missing version
Error: loading failed
Execution halted
ERROR: loading failed
removing 'C:/Users/JNolis2/Documents/R/win-library/3.5/testpackage'
In R CMD INSTALL
Exited with status 1.
How can I ensure the output is captured even during this step?

devtools::check() report error due to rJAVA

In Rstudio, I run devtools:check() in my project, and the following error occured
Error: .onLoad failed in loadNamespace() for 'rJava', details:
call: library.dynam("rJava", pkgname, libname)
error: DLL 'rJava' not found: maybe not installed for this architecture?
Before this error occur, I am pretty sure I successfully installed rJava using install.packages('rJava',type='source'), now I run .libPaths() and it returned
[1] "C:/Users/xxx/Documents/R/win-library/3.3" "C:/Program Files/R/R-3.3.1/library"
The rJava library I installed is in C:\Users\sunxd\Documents\R\win-library\3.3, and after I copy that into"C:/Program Files/R/R-3.3.1/library" it still does not work.
I could load rJava by library('rJava') anyway.
It seems that the problem is with different architecture, and I wonder why there should be different architecture on only one machine?
** running examples for arch 'x64' ... OK
Examples with CPU or elapsed time > 5s
user system elapsed
tuneParams 5.72 0 5.83
** found \donttest examples: check also with --run-donttest
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
** running tests for arch 'i386' ...
Running 'run-base.R' [17m]
Warning message:
running command '"C:/PROGRA~1/R/R-33~1.1/bin/i386/R" CMD BATCH --vanilla "run-base.R" "run-base.Rout"' had status 1

Error installing R package atSNP

I am trying to install an R package atSNP from https://github.com/chandlerzuo/atSNP. According to the documentation, this is how it is installed:
> library(devtools)
> install_github("chandlerzuo/atSNP")
But I get the following error:
Downloading github repo chandlerzuo/atSNP#master
Installing atSNP
Skipping 2 packages not available: GenomicRanges, motifStack
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore CMD INSTALL \
'/private/var/folders/vt/nnrr0hts2h1bk6stsg4mt2xw0000gn/T/Rtmpzjo43z/devtoolsd9a33b03bdb4/chandlerzuo-atSNP-8cbe50e' \
--library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library' --install-tests
* installing *source* package ‘atSNP’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs
** R
** data
** tests
** preparing package for lazy loading
No methods found in "IRanges" for requests: sapply
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
No methods found in "IRanges" for requests: sapply
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so, 6): no suitable image found. Did find:
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP’
Error: Command failed (1)
This is the session info:
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10 (Yosemite)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] motifStack_1.12.0 Biostrings_2.36.1 XVector_0.8.0 ade4_1.7-2 MotIV_1.24.0 grImport_0.9-0
[7] XML_3.98-1.2 GenomicRanges_1.20.4 GenomeInfoDb_1.4.0 IRanges_2.2.2 S4Vectors_0.6.0 BiocGenerics_0.14.0
[13] devtools_1.8.0
loaded via a namespace (and not attached):
[1] magrittr_1.5 GenomicAlignments_1.4.1 zlibbioc_1.14.0 BiocParallel_1.2.2 BSgenome_1.36.0
[6] lattice_0.20-31 stringr_1.0.0 httr_0.6.1 tools_3.2.0 seqLogo_1.34.0
[11] lambda.r_1.1.7 futile.logger_1.4.1 git2r_0.10.1 rversions_1.0.0 digest_0.6.8
[16] rtracklayer_1.28.4 futile.options_1.0.0 bitops_1.0-6 RCurl_1.95-4.6 memoise_0.2.1
[21] rGADEM_2.16.0 stringi_0.4-1 Rsamtools_1.20.4
As you can see, I have installed & attached both packages GenomicRanges & motifStack and still the installation message says they are not available. I have tried uninstalling & reinstalling both the packages but I still get the same error. Any suggestions will be appreciated.
UPDATE: I followed the suggestion below and still getting the following errors:
* installing to library ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library’
* installing *source* package ‘atSNP’ ...
** libs
make: Nothing to be done for `all'.
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs
** R
** data
** preparing package for lazy loading
No methods found in "IRanges" for requests: sapply
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
No methods found in "IRanges" for requests: sapply
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so, 6): no suitable image found. Did find:
/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP/libs/atSNP.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/atSNP’
Thanks
You can download the source package from the github website and install it. This gives no error on my Mac. In the terminal, type
git clone git://github.com/chandlerzuo/atSNP.git
R CMD INSTALL atSNP

Rcmdr Error : .onLoad failed in loadNamespace() for 'tcltk'

I have no idea what I'm doing but I need to use R and Rcmdr for my statistics class. I am running OS X 10.7.5, using 3.1.2 for R.
I have downloaded R.
install.packages("Rcmdr")
Picked a mirror, downloaded all packages. I then typed in
library(Rcmdr)
And received this error:
Loading required package: splines
Loading required package: RcmdrMisc
Loading required package: car
Loading required package: sandwich
Error : .onLoad failed in loadNamespace() for 'tcltk', details:
call: system2("otool", c("-L", shQuote(DLL)), stdout = TRUE)
error: error in running command
Error: package or namespace load failed for ‘Rcmdr’
sh: otool: command not found
When I do:
capabilities("tcltk")
# [1] TRUE
Have I done something wrong?
The R developers have tried to make a workaround for R not giving a useful error message when Tcl/Tk was not fully supported on a Mac. It seems R 3.1.2 depends on the otool from Xtools for this. However, you can download a patched version of R from http://r.research.att.com/ to remove the error.

Resources