Bug report #11603

R library can't install on windows in Processing

Added by Takayuki Mizutani over 9 years ago. Updated almost 7 years ago.

Status:Closed
Priority:High
Assignee:Victor Olaya
Category:Processing/Core
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

Description

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
set R_LIBS=%HOME%\\Documents\\R\\win-library\\3.1

But there is one restriction that it is already exist and writable folder.
Please fix this problem by source code fundamentally.

History

#1 Updated by Stefan Blumentrath almost 9 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 …
Variable: R_LIBS_USER
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...

#2 Updated by Stefan Blumentrath almost 9 years ago

Added a preliminary quick fix (comparable to Takayuki Mizutans solution) in https://github.com/qgis/QGIS/pull/2022
Yet, it has only effect at second start of QGIS, so in future a more elegant solution would be needed...

#3 Updated by Stefan Blumentrath almost 9 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).

#4 Updated by Giovanni Manghi almost 9 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

The PR was merged.

#5 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No

#6 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No

#7 Updated by Giovanni Manghi almost 7 years ago

Some providers are being removed from QGIS/Processing (will be available as plugin) and so are their categories in the bug tracker. To not leave them orphaned of a category they are being reassigned to processing/core.

#8 Updated by Giovanni Manghi almost 7 years ago

  • Category changed from 124 to Processing/Core

Also available in: Atom PDF