R-ArcGIS / r-bridge

Bridge library to connect ArcGIS and R, including arcgisbinding R library.
Apache License 2.0
118 stars 26 forks source link

cannot set library MODIS #41

Closed Murkor closed 3 years ago

Murkor commented 4 years ago

I need to use MODIS from ArcGIS Pro, but when run the R scripit from ArcGIS Pro and reach the statement: library(MODIS) get error despite the package installation was fine:

Running script Download Modis... [1] "C:/D/proyectos/2020/arauco/ds/PilotoArauco" [1] "C:/.../.Rprofile" Attaching package: 'nlme' The following object is masked from 'package:raster': getData

spatstat 1.64-1 (nickname: 'Help you I can, yes!') For an introduction to spatstat, type 'beginner' Attaching package: 'spatstat' The following objects are masked from 'package:raster': area, rotate, shift Registered S3 method overwritten by 'cli': method from
print.boxx spatstat Installing package into 'C:/Users/fhernandez/Documents/R/win-library/4.0' (as 'lib' is unspecified) trying URL 'http://cran.ma.imperial.ac.uk/bin/windows/contrib/4.0/MODIS_1.2.2.zip' Content type 'application/zip' length 691222 bytes (675 KB) downloaded 675 KB package 'MODIS' successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\fhernandez\AppData\Local\Temp\RtmpqyJhOc\downloaded_packages

-Error in value[[3L]] : package or namespace load failed for 'MODIS':
- .onLoad failed in loadNamespace() for 'pkgload', details:
-  call: NULL
-  error: C stack usage  981968 is too close to the limit
- Failed to execute (DownLoad).

However the R script in RStudio does not arise any problem.

Details on attached file modis.docx

orhuna commented 4 years ago

@Murkor when running R script from ArcGIS Pro you will be using more of the stack memory, that is why the R script, when run approaches the stack limit for C. You can first verify your stack size (should be close to the number printed in the error) by running the code below in a console: R --slave -e 'Cstack_info()["size"]'

then you can increase the stack size with following:

ulimit -s X where X will be the number you want to bump it to. 16384 will give you 16 MB, 32768 will give you 32 MB, 65536
will give you 64 MB on your stack, etc.