north-road / qgis-processing-r

QGIS Processing R Provider Plugin

Home Page:https://north-road.github.io/qgis-processing-r/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

R Libraries are really slow to install on windows

cratcliff opened this issue · comments

I am trying to use the R processing plugin with my R scripts. I have found that installing libraries takes a long time. The libraries I'm using are "sp","gstat","fields","mgcv","spTimer","rgdal","raster","gdalUtils","stringr".

Installing these libraries in QGIS using the R plugin (see Import_R_Libs.rsx.txt) takes over 30mins - I stopped it before it finished.

I also tried adding the installation within my R-Script (see Install_R_Libs.rsx.txt) and it also took over 30mins.

However installing from within RStudio using code in Install_R_Libs.rsx normally takes around 2mins or less.

While trying to find a faster solution I found that creating a windows batch file and using subprocess in a python script takes around 2mins as well.

This doesn't seem right. Am I doing something wrong? Is there a way to speed up the installation using the R processing plugin without having to resort to the batch file-python method?

I am using QGIS 3.18, R 4.0.3 and R processing plugin 3.0.0 on Windows 10 and my plugin settings are
R-Processing_Plugin_Settings

Thanks

This can be because the "User library folder" is pretty much empty or it should be at start (your first run). So you are installing all these packages with all their dependencies. That could take a long time - 30 minutes sounds long but it really might take that long. The installation takes longer if you allow compilation to happen (on Windows that means that you have RTools installed).

However, this should only happen once. Then the libraries should load without installation.

From RStudio the installation is faster, as some packages are already present in the library folder, so there are not that many dependencies.

@JanCaha I don't have access to install to the Program Files R folder so all installations are to empty user folders (one for each test), that are cleared out (along with cached temp download files) each time I tested and timed the installation so the times should be comparable. This includes from within R studio using the same code within the Install_R_LIbs.rsx file except new empty folder.