north-road / qgis-processing-r

QGIS Processing R Provider Plugin
https://north-road.github.io/qgis-processing-r/
GNU General Public License v3.0
63 stars 14 forks source link

Long long time to install default libraries #119

Open ghtmtt opened 1 year ago

ghtmtt commented 1 year ago

I tried with a new QGIS profile as well, but when running one of the example script (like scatterplot), the plugin wants to install these packages:

R execution console output
Installing package into ‘/home/matteo/.local/share/QGIS/QGIS3/profiles/matteo/processing/rlibs’
(as ‘lib’ is unspecified)
also installing the dependencies ‘sys’, ‘askpass’, ‘colorspace’, ‘geometries’, ‘jsonify’, ‘rapidjsonr’, ‘sfheaders’, ‘commonmark’, ‘gridExtra’, ‘systemfonts’, ‘promises’, ‘rappdirs’, ‘proxy’, ‘lazyeval’, ‘curl’, ‘mime’, ‘openssl’, ‘farver’, ‘labeling’, ‘munsell’, ‘stringi’, ‘fastmap’, ‘geojsonsf’, ‘crosstalk’, ‘markdown’, ‘viridis’, ‘leaflet.providers’, ‘brew’, ‘svglite’, ‘uuid’, ‘plyr’, ‘httpuv’, ‘bit’, ‘sass’, ‘cachem’, ‘timechange’, ‘goftest’, ‘tensor’, ‘rprojroot’, ‘fs’, ‘diffobj’, ‘rematch2’, ‘dichromat’, ‘XML’, ‘e1071’, ‘digest’, ‘jsonlite’, ‘rex’, ‘httr’, ‘crayon’, ‘withr’, ‘yaml’, ‘generics’, ‘glue’, ‘lifecycle’, ‘R6’, ‘cli’, ‘gtable’, ‘isoband’, ‘scales’, ‘evaluate’, ‘highr’, ‘stringr’, ‘xfun’, ‘base64enc’, ‘htmltools’, ‘htmlwidgets’, ‘leafem’, ‘leaflet’, ‘leafpop’, ‘png’, ‘satellite’, ‘servr’, ‘webshot’, ‘bit64’, ‘hms’, ‘fansi’, ‘utf8’, ‘later’, ‘bslib’, ‘jquerylib’, ‘tinytex’, ‘lubridate’, ‘plogr’, ‘memoise’, ‘pkgconfig’, ‘spatstat.data’, ‘spatstat.explore’, ‘spatstat.model’, ‘deldir’, ‘polyclip’, ‘spatstat.sparse’, ‘abind’, ‘brio’, ‘callr’, ‘desc’, ‘ellipsis’, ‘pkgload’, ‘praise’, ‘processx’, ‘ps’, ‘waldo’, ‘purrr’, ‘cpp11’, ‘tmaptools’, ‘RColorBrewer’, ‘viridisLite’, ‘widgetframe’, ‘leafsync’, ‘classInt’, ‘DBI’, ‘magrittr’, ‘Rcpp’, ‘s2’, ‘units’, ‘blob’, ‘covr’, ‘dplyr’, ‘ggplot2’, ‘knitr’, ‘lwgeom’, ‘maps’, ‘mapview’, ‘microbenchmark’, ‘odbc’, ‘pbapply’, ‘pillar’, ‘pool’, ‘raster’, ‘rlang’, ‘rmarkdown’, ‘RPostgres’, ‘RPostgreSQL’, ‘RSQLite’, ‘sp’, ‘spatstat’, ‘spatstat.geom’, ‘spatstat.random’, ‘spatstat.linnet’, ‘spatstat.utils’, ‘stars’, ‘terra’, ‘testthat’, ‘tibble’, ‘tidyr’, ‘tidyselect’, ‘tmap’, ‘vctrs’, ‘wk’

and it requires around 50 minutes:

Execution completed in 3106.77 seconds (51 minutes 47 seconds)

I was wondering if all the packages in the list are required.

I'm on a Linux Debian Sid machine and tested with QGIS 3.22 and 3.29 compiled.

JanCaha commented 1 year ago

The issue is that all of these packages are linked via dependencies to sf, raster, stars or sp (which are necessary for plugin to work correctly). I also noticed that the first run last very long, the reason probably is that on the packages that contain some C++ code are compiled, on Windows it should be significantly faster.

One thing that can be done, is to set Options -> Processing -> Providers -> R -> User Library Folder to a folder, that standard R instance uses for library installs (for me it is /home/user/R/x86_64-pc-linux-gnu-library/4.2). That way the normal R installation will share the libs with QGIS (unfortunately that is really hard to properly detect and better to do manually). If the user already has the libs, then the plugin will not install them again. That is so far only reasonable solution that I found.

ghtmtt commented 1 year ago

Thanks for the hint. If I'm setting the option to use the system folder over the user one, like this (the path of R is correct):

image

than I cannot open the R algorithms anymore:

image

Is it possible that the algorithms are not opening because in the system folder of R some required packages are missing?