[GRASS-stats] GRASS can't find R packages from personal library on Windows
Roger Bivand
Roger.Bivand at nhh.no
Fri Nov 18 04:11:52 PST 2016
On Fri, 18 Nov 2016, Helmut Kudrnovsky wrote:
> Roger Bivand wrote
>> In a context with Windows 7 without setting the R_LIBS_USER environment
>> variable, R outside GRASS reports:
>>
>>> Sys.getenv("HOME")
>> [1] "C:\\Users\\rsb\\Documents"
>>> .libPaths()
>> [1] "C:/Users/rsb/Documents/R/win-library/3.3"
>> [2] "C:/Program Files/R/R-3.3.2/library"
>>
>> but inside GRASS %HOME% is re-defined, so:
>>
>>> Sys.getenv("HOME")
>> [1] "C:\\Users\\rsb"
>>> .libPaths()
>> [1] "c:/Program Files/R/R-3.3.2/library"
>>
>> as R cannot construct: subdirectory ‘R/win-library/x.y’ of the home
>> directory, for R x.y.z, because "C:\\Users\\rsb/R/win-library/x.y" does
>> not exist, and that is where R is looking (here in GRASS):
>>
>>> Sys.getenv("R_LIBS_USER")
>> [1] "C:\\Users\\rsb/R/win-library/3.3"
>>
>> (the different dirseps do not matter).
>>
>> Does WinGRASS need to change the HOME environment variable? If it does,
>> users of R in GRASS need to set R_LIBS or R_LIBS_USER, easiest once via
>> Control Panel.
>
> I had a look into the sources; I can't find a line of code where winGRASS
> changes %HOME% at the moment; but it obvious uses %USERPROFILE% as %HOME%.
>
> and %USERPROFILE% points to in (at least newer) windows versions to
>
> e.g.
> echo %USERPROFILE%
> C:\Users\hkmyr
> C:\Users\\rsb
> etc.
>
> in a vanilla windows console, %HOME% isn't defined:
>
> echo %HOME%
> %HOME%
>
> within a winGRASS session
>
> echo %HOME%
> C:\Users\hkmyr
>
> it points to the folder defined under %USERPROFILE%
>
> add following line
>
> SET HOME=%USERPROFILE%\Documents
>
> below
>
> https://trac.osgeo.org/grass/browser/grass/trunk/mswindows/env.bat#L23
>
> has following effect within a winGRASS session:
>
> Cleaning up temporary files...
> Starting GRASS GIS...
> WARNING: Concurrent mapset locking is not supported on Windows
>
> __________ ___ __________ _______________
> / ____/ __ \/ | / ___/ ___/ / ____/ _/ ___/
> / / __/ /_/ / /| | \__ \\_ \ / / __ / / \__ \
> / /_/ / _, _/ ___ |___/ /__/ / / /_/ // / ___/ /
> \____/_/ |_/_/ |_/____/____/ \____/___//____/
>
> Welcome to GRASS GIS 7.0.5
> GRASS GIS homepage: http://grass.osgeo.org
> This version running through: Command Shell
> (C:\WINDOWS\system32\cmd.exe)
> Help is available with the command: g.manual -i
> See the licence terms with: g.version -c
> See citation options with: g.version -x
> If required, restart the GUI with: g.gui wxpython
> When ready to quit enter: exit
>
> Launching <wxpython> GUI in the background, please wait...
> Microsoft Windows [Version 10.0.14393]
> (c) 2016 Microsoft Corporation. Alle Rechte vorbehalten.
>
> C:\Users\hkmyr>
> C:\Users\hkmyr>echo %HOME%
> C:\Users\hkmyr\Documents
>
> C:\Users\hkmyr>R
>
> R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
> Copyright (C) 2016 The R Foundation for Statistical Computing
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> R is free software and comes with ABSOLUTELY NO WARRANTY.
> You are welcome to redistribute it under certain conditions.
> Type 'license()' or 'licence()' for distribution details.
>
> R is a collaborative project with many contributors.
> Type 'contributors()' for more information and
> 'citation()' on how to cite R or R packages in publications.
>
> Type 'demo()' for some demos, 'help()' for on-line help, or
> 'help.start()' for an HTML browser interface to help.
> Type 'q()' to quit R.
>
>> .libpaths()
> Error: could not find function ".libpaths"
>> .libPaths()
> [1] "C:/Users/hkmyr/Documents/R/win-library/3.3"
> [2] "C:/Program Files/R/R-3.3.1/library"
>>
>
> now also the private library is detected within a winGRASS session.
>
> no idea at the moment if this change in env.bat has a side effect to the
> winGRASS installation; further tests are needed.
>
See also
> ?"environment variables"
which on a Windows installation shows "R_USER" in the Windows specific
section at foot, this also loses /Documents within GRASS.
Roger
>
>
> -----
> best regards
> Helmut
> --
> View this message in context: http://osgeo-org.1560.x6.nabble.com/GRASS-can-t-find-R-packages-from-personal-library-on-Windows-tp5295771p5296449.html
> Sent from the Grass - Stats mailing list archive at Nabble.com.
> _______________________________________________
> grass-stats mailing list
> grass-stats at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-stats
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
http://depsy.org/person/434412
More information about the grass-stats
mailing list