[GRASS-stats] GRASS can't find R packages from personal library on Windows

Roger Bivand Roger.Bivand at nhh.no
Wed Nov 16 06:01:53 PST 2016


On Wed, 16 Nov 2016, Helmut Kudrnovsky wrote:

> Roger Bivand wrote
>> On Tue, 15 Nov 2016, Anna Petrášová wrote:
>> 
>>> Hi,
>>>
>>> I installed latest R on fresh Windows 10, then I installed several
>>> packages into my personal library, then I installed standalone GRASS
>>> GIS 7.3, and when I run R from GRASS session, it does not see the
>>> installed packages. .libPaths() called from GRASS session indeed does
>>> not show the path to the personal library. I installed the packages
>>> again in GRASS session and then it's OK. Any idea why this happens and
>>> how to avoid that?
>> 
>> No idea, only you can reproduce what you are doing. Do you mean 7.3, the 
>> development version? Try the 7.0 and 7.2 versions, and compare to see 
>> which environment variables may not be being transferred (R_LIBS probably) 
>> in GRASS 7.3. Are you running R in a Windows terminal (if such 
>> exists in Windows 10) inside GRASS, or in the command line in the 
>> GRASS GUI? If the latter, has this changed?
>
> tested with winGRASS7.2.svn standalone installer
>
> System Info 
> GRASS version: 7.2.svn 
> GRASS SVN revision: r69794 
> Build date: 2016-11-13 
> Build platform: x86_64-w64-mingw32 
> GDAL: 2.1.2 
> PROJ.4: 4.9.3 
> GEOS: 3.5.0 
> SQLite: 3.14.1 
> Python: 2.7.5 
> wxPython: 2.8.12.1 
> Platform: Windows-8-6.2.9200 
>
> in the winGRASS-provided windows console:
>
> Cleaning up temporary files...
> Starting GRASS GIS...
> WARNING: Concurrent mapset locking is not supported on Windows
>
>          __________  ___   __________    _______________
>         / ____/ __ \/   | / ___/ ___/   / ____/  _/ ___/
>        / / __/ /_/ / /| | \__ \\_  \   / / __ / / \__ \
>       / /_/ / _, _/ ___ |___/ /__/ /  / /_/ // / ___/ /
>       \____/_/ |_/_/  |_/____/____/   \____/___//____/
>
> Welcome to GRASS GIS 7.2.svn (r69794)
> 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\test>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.

You would need to try to load a package from your personal library, so:

.libPaths()
library()
installed.packages()

should show whether anything is found, and to install within the GRASS 
session:

install.packages("rgrass7")
library(rgrass7)

and see what happens.

For me on Linux, R_LIBS is set by me and works, but on Windows the default 
is (possibly) set in the Registry anyway, which would/should be used if 
R_LIBS is not set. Within R, .libPaths() should be the same inside GRASS 
and outside GRASS. In Linux I have chosen to set R_LIBS, in Windows 7, 
GRASS standalone 7.0.4, I can start R GUI in the GRASS GUI console command 
line, and my personal library is found (no R_LIBS set, .libPaths() returns 
the default). I haven't tried with GRASS 7.2 on Windows.

Roger

>
>> q()
> Save workspace image? [y/n/c]: n
>
> C:\Users\test>echo %R_LIBS%
> %R_LIBS%
>
> I've implemented the R-winGRASS-connecting for the standalone installer by
>
> https://trac.osgeo.org/grass/browser/grass/trunk/mswindows/external/rbatch
> https://trac.osgeo.org/grass/browser/grass/trunk/mswindows/external/rbatch/R.bat
>
> %R_LIBS% isn't listed there.
>
>
>
>
> -----
> 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-tp5295771p5296042.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