Problem with initGRASS

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with initGRASS

Jaime Burbano Girón
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:

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.
--
Jaime Burbano Girón
Estudiante Doctoral
Doctorado en Estudios Ambientales y Rurales
Pontificia Universidad Javeriana
Bogotá, Colombia
(57-1) 3208320 Ext. 4844

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Problem with initGRASS

Roger Bivand
Administrator
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: [hidden email]
http://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway
Reply | Threaded
Open this post in threaded view
|

Re: Problem with initGRASS

Chris Reudenbach
Jaime,

if the location of your GRASS installation is not known you may also
give the link2GI package a try.

try link2GI::linkGRASS7() for a "brute force" searching and linking.
This should setup your enviroment for using the newest GRASS version.

cheers Chris

On 23/11/2018 09:44, Roger Bivand wrote:

> 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.
>>
>
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

--
Dr Christoph Reudenbach, Philipps-University of Marburg, Faculty of Geography, GIS and Environmental Modeling, Deutschhausstr. 10, D-35032 Marburg, fon: ++49.(0)6421.2824296, fax: ++49.(0)6421.2828950, web: gis-ma.org, giswerk.org, moc.environmentalinformatics-marburg.de


        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo