hi devs, the subject question oroginates from
[GRASS-stats] GRASS can't find R packages from personal library on Windows https://lists.osgeo.org/pipermail/grass-stats/2016-November/001690.html technical background on winGRASS side: %HOME% is defined in winGRASS by: for trunk https://trac.osgeo.org/grass/browser/grass/trunk/lib/init/grass.py#L712 712 def ensure_home(): 713 """Set HOME if not set on MS Windows""" 714 if windows and not os.getenv('HOME'): 715 os.environ['HOME'] = os.path.join(os.getenv('HOMEDRIVE'), 716 os.getenv('HOMEPATH')) and for the 7.0.x-line https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_7_0/lib/init/grass.py#L1338 1338 # set HOME 1339 if windows and not os.getenv('HOME'): 1340 os.environ['HOME'] = os.path.join(os.getenv('HOMEDRIVE'), 1341 os.getenv('HOMEPATH')) both definitions turn out to be (on the most newer windows boxes) the same as %USERPROFILE% (e.g C:\Users\yourusername). technical background on R side: if %HOME% is _unset_ on windows, R looks for private libraries in C:\Users\yourusername\Documents\R\win-library\3.3, etc) but if %HOME% is _set_ on windows, R looks for private libraries on the wrong place (C:\Users\yourusername\R\win-library\3.3, etc.) <= see the missing _Documents_ as opposite to above search path for private libraries; thus R can't expand its search path to private libraries, as these are installed by default in C:\Users\yourusername\Documents\R\win-library\3.3, etc. some ways to overcome this R-winGRASS-integration issue: (1) add some notes in the GRASS-wiki to add manually R_LIBS_USER (=path to private library in R) via the windows control panel permanently or temporary in the winGRASS-command console by e.g. set R_LIBS_USER=path/to/your/private/ (2) add some notes in the GRASS-wiki how to add R_LIBS_USER in a R session. (3) add some logic in the windows-winGRASS-bat-start up scripts to add R_LIBS_USER (4) add some logic in the (win)GRASS-startup-GUI to define R_LIBS_USER (5) or see [1] to set %HOME% in windows to %USERPROFILE/Documents instead of %USERPROFILE% add following line SET HOME=%USERPROFILE%\Documents below https://trac.osgeo.org/grass/browser/grass/trunk/mswindows/env.bat#L23 to catch the most common R private library installations. I couldn't find any hints in the source where %HOME% is used in winGRASS modules/scripts. any opinion? any objection? any additions? [1] https://lists.osgeo.org/pipermail/grass-stats/2016-November/001705.html ----- best regards Helmut -- View this message in context: http://osgeo-org.1560.x6.nabble.com/changing-HOME-in-winGRASS-for-a-better-R-winGRASS-integration-discussion-tp5296480.html Sent from the Grass - Dev mailing list archive at Nabble.com. _______________________________________________ grass-dev mailing list grass-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-dev