Bug report #11603
R library can't install on windows in Processing
|Affected QGIS version:||2.6.0||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19860|
First running R in processing, it try to install R library (rgdal etc.) in the unwritable folder on windows.
So the error has occured like 'lib="C:/Program Files/R/R-3.1.1/library" is not writable'
For solving this problem, I have added this line in qgis.bat (C:\\OSGeo4W\\bin\\qgis.bat or C:\\Program Files\\QGIS Brighton\\bin\\qgis.bat).
REM add this line
But there is one restriction that it is already exist and writable folder.
Please fix this problem by source code fundamentally.
#1 Updated by Stefan Blumentrath over 8 years ago
Sounds like a good (in terms of convenient for the user) solution could be to add the possibility to specify R_LIBS_USER in the options for the R provider. If nothing is specified yet (environment variable is empty), a sub-folder in the Processing folder within the user home could be created and used as a default. Content/path of R_LIBS_USER could be read from environment variables (if the variable is already set). (BTW: a variable in the Processing options for the default cran mirror to be used could be nice too)
On Win 7, users can set their environment variables (without admin rights) permanently like this:
Windows button -> Control panel -> User accounts -> Change my environment variables -> New …
Value: “Path to folder where R libraries should be stored” the folder has to exist and has to be writable.
Otherwise, R buries packages somewhere in C:\\Users\\USERNAME\\AppData\\Local\\temp\\A_CRYPICAL_FOLDER_NAME\\downloaded_packages
Therefore, setting R_LIBS_USER as an environment variable seems to be a good idea anyway (An ".Renviron" file in the user home did not seem to have effect on Windows (but I tested only swiftly). For further reading see: http://cran.r-project.org/bin/windows/base/rw-FAQ.html)
So, this issue is probably more a question of a properly configured R installation than a real processing issue and an update of the documentation (http://docs.qgis.org/testing/en/docs/user_manual/processing/3rdParty.html) might be sufficient...
#3 Updated by Stefan Blumentrath over 8 years ago
- Target version set to Version 2.8.2
Please have a look at: https://github.com/qgis/QGIS/pull/2028 (pull request 2022 has been closed).
This new pull request adds the possibility to define a path for R user libraries on Windows and injects the specified library path into R scripts (using .libPaths() function in R).