[GRASS-stats] error initGRASS - rgrass7

Rainer M Krug Rainer at krugs.de
Fri Jul 24 00:47:37 PDT 2015


Markus Neteler <neteler at osgeo.org> writes:

> On Wed, Jul 22, 2015 at 3:11 PM, Rainer M Krug <Rainer at krugs.de> wrote:
>> Hi Veronica,
>>
>> Veronica Andreo <veroandreo at gmail.com> writes:
>>
>>> Hi,
>>>
>>> I'm trying to run GRASS from R using:
>>>
>>> library(rgrass7)
>>> initGRASS(gisBase="/home/veroandreo/software/grass-7.0.svn",
>>>           home=tempdir(), gisDbase="/home/veroandreo/grassdata",
>>>           location="latlong_wgs84", mapset="clorofila", override=TRUE)
>>
>> I assume you use Linux.
>>
>>>
>>> but I get the following error:
>>>
>>> sh: g.gisenv: command not foundsh: g.gisenv: command not foundsh:
>>> g.gisenv: command not foundsh: g.gisenv: command not foundsh:
>>> g.gisenv: command not foundsh: g.version: command not foundError in
>>> system(paste("g.version", get("addEXE", envir = .GRASS_CACHE),  :
>>>   error in running command
>>>
>>>
>>> Am I lacking something or is the function broken?? How should I use it??
>>
>> The easiest way of using R and GRASS GIS together, is starting GRASS GIS
>> and then in starting R in GRASS. This way, initGRASS() is not needed
>> anymore as the environment is already set up.
>
Hi

> We (especially Veronica) worked during the recent Community Sprint on
> the Wiki pages
>
> http://grasswiki.osgeo.org/wiki/R_statistics
>
> to improve it, move out subchapters into separate pages etc.

I think this is a brilliant idea.

I just looked at the example (GRASS GIS 7 in R), and it seems you are
specifying the wrong gisBase argument.

I get the same error in this case. If I specify the correct one, in my
case "/usr/local/Cellar/grass-70/7.0.0/grass-7.0.0" which looks as
follow (I highlighted the important directories, as far as I know):

,----
| 09:42:39 (master) /usr/local/Cellar/grass-70/7.0.0/grass-7.0.0$ ls -l
| total 240
| -rw-r--r--    1 rainerkrug  admin  15589 Jul 22 14:54 AUTHORS
| -rw-r--r--    1 rainerkrug  admin   1136 Jul 22 14:54 CHANGES
| -rw-r--r--    1 rainerkrug  admin   1458 Jul 22 14:54 COPYING
| -rw-r--r--    1 rainerkrug  admin  17987 Jul 22 14:54 GPL.TXT
| -rw-r--r--    1 rainerkrug  admin   7633 Jul 22 14:54 REQUIREMENTS.html
| drwxr-xr-x  373 rainerkrug  admin  12682 Jul 22 14:54 bin   <<<<<<<<<<<<<<<<<<<<<<<<
| -rwxr-xr-x    1 rainerkrug  admin  30466 Jul 22 14:54 config.status
| -rw-r--r--    1 rainerkrug  admin   3556 Jul 22 14:54 contributors.csv
| -rw-r--r--    1 rainerkrug  admin   1672 Jul 22 14:54 contributors_extra.csv
| drwxr-xr-x    4 rainerkrug  admin    136 Jul 22 14:54 demolocation
| drwxr-xr-x    4 rainerkrug  admin    136 Jul 22 14:52 docs
| drwxr-xr-x    3 rainerkrug  admin    102 Jul 22 14:52 driver
| drwxr-xr-x   28 rainerkrug  admin    952 Jul 22 14:54 etc
| drwxr-xr-x   25 rainerkrug  admin    850 Jul 22 14:52 fonts
| lrwxr-xr-x    1 rainerkrug  admin     14 Jul 22 14:55 grass70.sh -> ../bin/grass70
| drwxr-xr-x    7 rainerkrug  admin    238 Jul 22 14:54 gui
| drwxr-xr-x    4 rainerkrug  admin    136 Jul 22 14:52 include
| drwxr-xr-x  105 rainerkrug  admin   3570 Jul 22 14:54 lib   <<<<<<<<<<<<<<<<<<<<<<<<
| drwxr-xr-x   24 rainerkrug  admin    816 Jul 22 14:54 locale
| drwxr-xr-x  125 rainerkrug  admin   4250 Jul 22 14:54 scripts
| drwxr-xr-x    4 rainerkrug  admin    136 Jul 22 14:54 share
| drwxr-xr-x    9 rainerkrug  admin    306 Jul 22 14:52 tools
| -rw-r--r--    1 rainerkrug  admin  12668 Jul 22 14:54 translation_status.json
| -rw-r--r--    1 rainerkrug  admin   4111 Jul 22 14:54 translators.csv
`----

it works without any problems (Mac OSX Yosemite).

,----
| > sessionInfo()
| R version 3.2.1 (2015-06-18)
| Platform: x86_64-apple-darwin14.4.0 (64-bit)
| Running under: OS X 10.10.4 (Yosemite)
| 
| locale:
| [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods   base
| 
| other attached packages:
| [1] rgrass7_0.1-0 XML_3.98-1.3  sp_1.1-1
| 
| loaded via a namespace (and not attached):
| [1] tools_3.2.1     grid_3.2.1      lattice_0.20-31
| > version
|                _
| platform       x86_64-apple-darwin14.4.0
| arch           x86_64
| os             darwin14.4.0
| system         x86_64, darwin14.4.0
| status
| major          3
| minor          2.1
| year           2015
| month          06
| day            18
| svn rev        68531
| language       R
| version.string R version 3.2.1 (2015-06-18)
| nickname       World-Famous Astronaut
| >
`----

Hope this helps.

Rainer

> The scope is to explain both directions which used to work with spgrass6.
>
> Best
> Markus
>
>> Are you sure that you gisBase is correct? Does GRASS work if you start
>> it?
>>
>> Cheers,
>>
>> Rainer
>>
>>>
>>> Any help is appretiated :)
>>>
>>>
>>> Thanks much in advance,
>>>
>>> Vero
>>> _______________________________________________
>>> grass-stats mailing list
>>> grass-stats at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-stats
>>
>> --
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Stellenbosch University
>> South Africa
>>
>> Tel :       +33 - (0)9 53 10 27 44
>> Cell:       +33 - (0)6 85 62 59 98
>> Fax :       +33 - (0)9 58 10 27 44
>>
>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>
>> email:      Rainer at krugs.de
>>
>> Skype:      RMkrug
>>
>> PGP: 0x0F52F982
>>
>> _______________________________________________
>> grass-stats mailing list
>> grass-stats at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-stats

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug

PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 480 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-stats/attachments/20150724/ff1c3f35/attachment.pgp>


More information about the grass-stats mailing list