[R-sig-Geo] Problem with initGRASS

Roger Bivand Roger@Biv@nd @ending from nhh@no
Fri Nov 23 09:44:28 CET 2018


On Fri, 23 Nov 2018, Jaime Burbano Girón wrote:

> Hi everyone,
>
> I'm trying to use GRASS in R, but I can't get to initialize it. I'm using
> Ubuntu 18.04 and GRASS 7.4.2. This is the system information:
>
> Versión de GRASS: 7.4.2
>
> Revisión SVN de GRASS: exported
>
> Fecha de compilación: 2018-10-28
>
> Construir plataforma: x86_64-pc-linux-gnu
>
> GDAL: 2.2.3
>
> PROJ.4: 4.9.3
>
> GEOS: 3.6.2
>
> SQLite: 3.22.0
>
> Python: 2.7.15rc1
>
> wxPython: 3.0.2.0
>
> Plataforma: Linux-4.15.0-38-generic-x86_64-with-Ubuntu-18.04-bionic
>
>
> I'm running: > initGRASS(gisBase="/usr/lib/grass74/bin",override=T)
> And this is the error:

No, ?initGRASS says:

gisBase: The directory path to GRASS binaries and libraries

and grass74/bin only contains (for me):

$ ls bin
grass74

which is a Python script, ASCII text executable. Trying

grass74/grass-7.4.2

(no idea where your installer puts this):

$ ls grass-7.4.2
AUTHORS           contributors_extra.csv  fonts    REQUIREMENTS.html
bin               COPYING                 GPL.TXT  scripts
CHANGES           demolocation            gui      share
CITING            docs                    include  tools
config.status     driver                  INSTALL  translators.csv
contributors.csv  etc                     lib

which contains the binaries in bin and the libraries in lib. The required 
string is what is set in the shell variable GISBASE when running GRASS 
interactively:

echo $GISBASE

hence the name of the argument. initGRASS() cannot discover this as GRASS 
is not running, and has not set its environment variables. I have added a 
test looking for a directory called bin in the directory given as the 
gisBase argument, check on https://r-forge.r-project.org/R/?group_id=2020 
to see when rgrass7 0.1-13 (Rev: 68) has build status current, try that 
with your current setting, the correct setting and report back.

Hope this clarifies,

Roger


>
> sh: 1: g.gisenv: not foundsh: 1: g.gisenv: not foundsh: 1: g.gisenv:
> not foundsh: 1: g.gisenv: not foundsh: 1: g.gisenv: not foundsh: 1:
> g.version: not foundError in system(paste("g.version", get("addEXE",
> envir = .GRASS_CACHE),  :
>  error in running commandAdemás: Warning messages:1: In
> system(paste(paste("g.gisenv", get("addEXE", envir = .GRASS_CACHE),  :
> error in running command2: In system(paste(paste("g.gisenv",
> get("addEXE", envir = .GRASS_CACHE),  :  error in running command3: In
> system(paste(paste("g.gisenv", get("addEXE", envir = .GRASS_CACHE),  :
> error in running command4: In system(paste(paste("g.gisenv",
> get("addEXE", envir = .GRASS_CACHE),  :  error in running command5: In
> system(paste(paste("g.gisenv", get("addEXE", envir = .GRASS_CACHE),  :
> error in running command
>
>
> I verified that g.gisenv and g.version are located in /usr/lib/grass74/bin.
> Any suggestion?
>
> Thanks in advance.
>
> Best,
>
> Jaime.
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the R-sig-Geo mailing list