Re: [GRASS-user] Running r-grass examples when building a R package

Bernardo Santos via grass-stats <[email protected]> Tue, 30 Aug 2022 11:18:44 +0000 (UTC)
Newsgroups gmane.comp.gis.grass.stats,gmane.comp.gis.grass.user
Message-ID <[email protected]>
--===============4072531381966279580==
Content-Type: multipart/alternative; 
	boundary="----=_Part_1680676_41530391.1661858324343"

------=_Part_1680676_41530391.1661858324343
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 Hi Stefan,(and thanks Roger and Floris for replying as well)
Your solution worked perfectly, Stefan. Thanks a lot!In the case of continu=
ous integration within Github as it is the case, it seems we must ask GRASS=
 to be installed in the virtual machine.
This could be done with Stefan's suggestion, adding these lines to the yaml=
 file within .github/workflows:
- name: Install GRASS GIS and other dependencies=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 run: |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sudo apt-get update -qq=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 sudo apt-get install -y -qq grass grass-dev grass-=
doc wget
You can also see it here:=C2=A0Install GRASS for CI by ninsbl =C2=B7 Pull R=
equest #11 =C2=B7 NINAnor/oneimpact (github.com)
I guess this could be documented for GRASS/R users somewhere? Maybe in some=
 wiki?Any suggestion on where to add this?

BestBernardo

    Em sexta-feira, 26 de agosto de 2022 13:27:46 GMT+2, Stefan Blumentrath=
 <[email protected]> escreveu: =20
=20
  <!--#yiv0852532148 _filtered {} _filtered {} _filtered {} _filtered {}#yi=
v0852532148 #yiv0852532148 p.yiv0852532148MsoNormal, #yiv0852532148 li.yiv0=
852532148MsoNormal, #yiv0852532148 div.yiv0852532148MsoNormal {margin:0cm;f=
ont-size:11.0pt;font-family:"Calibri", sans-serif;}#yiv0852532148 a:link, #=
yiv0852532148 span.yiv0852532148MsoHyperlink {color:blue;text-decoration:un=
derline;}#yiv0852532148 pre {margin:0cm;margin-bottom:.0001pt;font-size:10.=
0pt;font-family:"Courier New";}#yiv0852532148 span.yiv0852532148HTMLPreform=
attedChar {font-family:Consolas;}#yiv0852532148 span.yiv0852532148ydpa6a651=
1er-in {}#yiv0852532148 span.yiv0852532148ydpa6a6511efu {}#yiv0852532148 sp=
an.yiv0852532148ydpa6a6511eop {}#yiv0852532148 span.yiv0852532148ydpa6a6511=
est {}#yiv0852532148 span.yiv0852532148ydpa6a6511ecn {}#yiv0852532148 span.=
yiv0852532148EmailStyle26 {font-family:"Calibri", sans-serif;color:windowte=
xt;}#yiv0852532148 .yiv0852532148MsoChpDefault {font-size:10.0pt;} _filtere=
d {}#yiv0852532148 div.yiv0852532148WordSection1 {}-->
Hi Bernardo,
=20
 =C2=A0
=20
Seems like GRASS GIS isn`t installed on the CI VM.
=20
 =C2=A0
=20
Please see:
=20
https://github.com/NINAnor/oneimpact/pulls
=20
 =C2=A0
=20
You may add UbuntuGIS PPAs if you want other versions than shipped by plain=
 Ubuntu.
=20
 =C2=A0
=20
Cheers
=20
Stefan
=20
 =C2=A0
=20
From: grass-user <[email protected]>On Behalf Of Bernardo =
Santos via grass-user
Sent: fredag 26. august 2022 12:56
To: [email protected]; GRASS User List <[email protected]=
g>
Subject: [GRASS-user] Running r-grass examples when building a R package
=20
 =C2=A0
=20
Dear all,
=20
 =C2=A0
=20
I am building a R package and some of the functions use rgrass to connect t=
o a GRASS project and run thingfs within GRASS.
=20
I have now set up a webpage for the package using pkgdown in integrated to =
Github actions. This means when I push new commits all the examples of R fu=
nctions are run again and the webpage is updated with the results of the ex=
amples. Here is the webpage:=C2=A0https://ninanor.github.io/oneimpact/
=20
 =C2=A0
=20
All works fine, except the functions calling GRASS. When I run the examples=
 form my local computer everything works, but in the Github actions it does=
 not run, apparently because the command
=20
 =C2=A0
 system("grass78 --config path", intern =3D T)=20
to find the GRASS folder and use within rgrass::initGRASS does not work, so=
 the connection between R and GRASS do not exist.
=20
 =C2=A0
=20
Does someone in the group has experience with that and could help with hint=
s to solve it?
=20
Is there a recommended way to make sure Github actions know where GRASS is =
and use it?
=20
 =C2=A0
=20
Best
=20
Bernardo
  =20
------=_Part_1680676_41530391.1661858324343
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydp2e917366yahoo-style-wrap" style=
=3D"font-size: 16px; font-family: Helvetica Neue, Helvetica, Arial, sans-se=
rif;"><div style=3D"font-family: Helvetica Neue, Helvetica, Arial, sans-ser=
if;"></div>
        <div dir=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helvet=
ica Neue, Helvetica, Arial, sans-serif;">Hi Stefan,</div><div dir=3D"ltr" d=
ata-setdir=3D"false" style=3D"font-family: Helvetica Neue, Helvetica, Arial=
, sans-serif;">(and thanks Roger and Floris for replying as well)</div><div=
 dir=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helvetica Neue, He=
lvetica, Arial, sans-serif;"><br></div><div dir=3D"ltr" data-setdir=3D"fals=
e" style=3D"font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">You=
r solution worked perfectly, Stefan. Thanks a lot!</div><div dir=3D"ltr" da=
ta-setdir=3D"false" style=3D"font-family: Helvetica Neue, Helvetica, Arial,=
 sans-serif;">In the case of continuous integration within Github as it is =
the case, it seems we must ask GRASS to be installed in the virtual machine=
.</div><div dir=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helveti=
ca Neue, Helvetica, Arial, sans-serif;"><br></div><div dir=3D"ltr" data-set=
dir=3D"false" style=3D"font-family: Helvetica Neue, Helvetica, Arial, sans-=
serif;">This could be done with Stefan's suggestion, adding these lines to =
the yaml file within .github/workflows:</div><div dir=3D"ltr" data-setdir=
=3D"false" style=3D""><div style=3D""><div style=3D"font-family: Helvetica =
Neue, Helvetica, Arial, sans-serif;"><br></div><div style=3D""><font face=
=3D"courier new, courier, monaco, monospace, sans-serif">- name: Install GR=
ASS GIS and other dependencies</font></div><div style=3D""><font face=3D"co=
urier new, courier, monaco, monospace, sans-serif">&nbsp; &nbsp; &nbsp; &nb=
sp; run: |</font></div><div style=3D""><font face=3D"courier new, courier, =
monaco, monospace, sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sudo apt-=
get update -qq</font></div><div style=3D""><font face=3D"courier new, couri=
er, monaco, monospace, sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sudo =
apt-get install -y -qq grass grass-dev grass-doc wget</font></div></div></d=
iv><div dir=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helvetica N=
eue, Helvetica, Arial, sans-serif;"><br></div><div dir=3D"ltr" data-setdir=
=3D"false" style=3D"font-family: Helvetica Neue, Helvetica, Arial, sans-ser=
if;">You can also see it here:&nbsp;<span><a href=3D"https://github.com/NIN=
Anor/oneimpact/pull/11/commits/8c77deaa92cbae2cf2dd909c47b67ad356801b9b" re=
l=3D"nofollow" target=3D"_blank">Install GRASS for CI by ninsbl =C2=B7 Pull=
 Request #11 =C2=B7 NINAnor/oneimpact (github.com)</a></span></div><div dir=
=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helvetica Neue, Helvet=
ica, Arial, sans-serif;"><br></div><div dir=3D"ltr" data-setdir=3D"false" s=
tyle=3D"font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">I guess=
 this could be documented for GRASS/R users somewhere? Maybe in some wiki?<=
/div><div dir=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helvetica=
 Neue, Helvetica, Arial, sans-serif;">Any suggestion on where to add this?<=
br></div><div dir=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helve=
tica Neue, Helvetica, Arial, sans-serif;"><br></div><div dir=3D"ltr" data-s=
etdir=3D"false" style=3D"font-family: Helvetica Neue, Helvetica, Arial, san=
s-serif;">Best</div><div dir=3D"ltr" data-setdir=3D"false" style=3D"font-fa=
mily: Helvetica Neue, Helvetica, Arial, sans-serif;">Bernardo</div><div dir=
=3D"ltr" data-setdir=3D"false" style=3D"font-family: Helvetica Neue, Helvet=
ica, Arial, sans-serif;"><br></div><div style=3D"font-family: Helvetica Neu=
e, Helvetica, Arial, sans-serif;"><br></div>
       =20
        </div><div id=3D"yahoo_quoted_1896614575" class=3D"yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                    Em sexta-feira, 26 de agosto de 2022 13:27:46 GMT+2, St=
efan Blumentrath &lt;[email protected]&gt; escreveu:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id=3D"yiv0852532148">

=20
=20
<style><!--
#yiv0852532148 =20
 _filtered {}
 _filtered {}
 _filtered {}
 _filtered {}
#yiv0852532148 =20
#yiv0852532148 p.yiv0852532148MsoNormal, #yiv0852532148 li.yiv0852532148Mso=
Normal, #yiv0852532148 div.yiv0852532148MsoNormal
=09{margin:0cm;font-size:11.0pt;font-family:"Calibri", sans-serif;}
#yiv0852532148 a:link, #yiv0852532148 span.yiv0852532148MsoHyperlink
=09{color:blue;text-decoration:underline;}
#yiv0852532148 pre
=09{margin:0cm;margin-bottom:.0001pt;font-size:10.0pt;font-family:"Courier =
New";}
#yiv0852532148 span.yiv0852532148HTMLPreformattedChar
=09{font-family:Consolas;}
#yiv0852532148 span.yiv0852532148ydpa6a6511er-in
=09{}
#yiv0852532148 span.yiv0852532148ydpa6a6511efu
=09{}
#yiv0852532148 span.yiv0852532148ydpa6a6511eop
=09{}
#yiv0852532148 span.yiv0852532148ydpa6a6511est
=09{}
#yiv0852532148 span.yiv0852532148ydpa6a6511ecn
=09{}
#yiv0852532148 span.yiv0852532148EmailStyle26
=09{font-family:"Calibri", sans-serif;color:windowtext;}
#yiv0852532148 .yiv0852532148MsoChpDefault
=09{font-size:10.0pt;}
 _filtered {}
#yiv0852532148 div.yiv0852532148WordSection1
=09{}
--></style>

<div>
<div class=3D"yiv0852532148WordSection1">
<p class=3D"yiv0852532148MsoNormal"><span style=3D"">Hi Bernardo,</span></p=
>=20
<p class=3D"yiv0852532148MsoNormal"><span style=3D""> &nbsp;</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D"">Seems l=
ike GRASS GIS isn`t installed on the CI VM.</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D""> &nbsp;=
</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D"">Please =
see:</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D""><a rel=
=3D"nofollow noopener noreferrer" target=3D"_blank" href=3D"https://github.=
com/NINAnor/oneimpact/pulls">https://github.com/NINAnor/oneimpact/pulls</a>=
</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D""> &nbsp;=
</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D"">You may=
 add UbuntuGIS PPAs if you want other versions than shipped by plain Ubuntu=
.</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D""> &nbsp;=
</span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D"">Cheers<=
/span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D"">Stefan<=
/span></p>=20
<p class=3D"yiv0852532148MsoNormal"><span lang=3D"EN-US" style=3D""> &nbsp;=
</span></p>=20
<div>
<div style=3D"border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm =
0cm 0cm;">
<p class=3D"yiv0852532148MsoNormal"><b><span lang=3D"EN-US">From:</span></b=
><span lang=3D"EN-US"> grass-user &lt;[email protected]&gt=
;
<b>On Behalf Of </b>Bernardo Santos via grass-user<br>
<b>Sent:</b> fredag 26. august 2022 12:56<br>
<b>To:</b> [email protected]; GRASS User List &lt;grass-user@list=
s.osgeo.org&gt;<br>
<b>Subject:</b> [GRASS-user] Running r-grass examples when building a R pac=
kage</span></p>=20
</div>
</div>
<p class=3D"yiv0852532148MsoNormal"> &nbsp;</p>=20
<div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">Dear all,</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;"> &nbsp;</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">I am building a R package and some of the functions use rgrass=
 to connect to a GRASS project and run thingfs within GRASS.</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">I have now set up a webpage for the package using pkgdown in i=
ntegrated to Github actions. This means when I push new commits all the exa=
mples of R functions are run again
 and the webpage is updated with the results of the examples. Here is the w=
ebpage:&nbsp;<a rel=3D"nofollow noopener noreferrer" target=3D"_blank" href=
=3D"https://eur01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fnin=
anor.github.io%2Foneimpact%2F&amp;data=3D05%7C01%7CStefan.Blumentrath%40nin=
a.no%7C4ec863c6b2d14350bafa08da8751a786%7C6cef373021314901831055b3abf02c73%=
7C0%7C0%7C637971082028512352%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLC=
JQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=3DtL=
KgU9W3QU2M9Jyr4lWtCa3qDuvvH%2B4d41sewIzdYPU%3D&amp;reserved=3D0">https://ni=
nanor.github.io/oneimpact/</a></span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;"> &nbsp;</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">All works fine, except the functions calling GRASS. When I run=
 the examples form my local computer everything works, but in the Github ac=
tions it does not run, apparently
 because the command</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;"> &nbsp;</span></p>=20
</div>
<div>
<div style=3D"border:solid #DEE2E6 1.0pt;padding:0cm 0cm 0cm 0cm;background=
:#F1F3F5;">
<pre style=3D"background:#F1F3F5;border:none;padding:0cm;"><span class=3D"y=
iv0852532148ydpa6a6511efu"><span style=3D"color:#4758AB;"><a rel=3D"nofollo=
w noopener noreferrer" target=3D"_blank" href=3D"https://eur01.safelinks.pr=
otection.outlook.com/?url=3Dhttps%3A%2F%2Frdrr.io%2Fr%2Fbase%2Fsystem.html&=
amp;data=3D05%7C01%7CStefan.Blumentrath%40nina.no%7C4ec863c6b2d14350bafa08d=
a8751a786%7C6cef373021314901831055b3abf02c73%7C0%7C0%7C637971082028512352%7=
CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi=
LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=3DXlu8yfS8TnTLHdkRc91AGeQI8fUCDpRd=
CbySjheiaNY%3D&amp;reserved=3D0">system</a></span></span><span class=3D"yiv=
0852532148ydpa6a6511eop"><span style=3D"color:#5E5E5E;">(</span></span><spa=
n class=3D"yiv0852532148ydpa6a6511est"><span style=3D"color:#20794D;">"gras=
s78 --config path"</span></span><span class=3D"yiv0852532148ydpa6a6511er-in=
"><span style=3D"color:#003B4F;">, intern </span></span><span class=3D"yiv0=
852532148ydpa6a6511eop"><span style=3D"color:#5E5E5E;">=3D</span></span><sp=
an class=3D"yiv0852532148ydpa6a6511er-in"><span style=3D"color:#003B4F;"> <=
/span></span><span class=3D"yiv0852532148ydpa6a6511ecn"><span style=3D"colo=
r:#8F5902;">T</span></span><span class=3D"yiv0852532148ydpa6a6511eop"><span=
 style=3D"color:#5E5E5E;">)</span></span><span style=3D"font-size:10.5pt;co=
lor:black;"></span></pre>=20
</div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">to find the GRASS folder and use within rgrass::initGRASS does=
 not work, so the connection between R and GRASS do not exist.</span></p>=
=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;"> &nbsp;</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">Does someone in the group has experience with that and could h=
elp with hints to solve it?</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">Is there a recommended way to make sure Github actions know wh=
ere GRASS is and use it?</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;"> &nbsp;</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">Best</span></p>=20
</div>
<div>
<p class=3D"yiv0852532148MsoNormal"><span style=3D"font-size:12.0pt;font-fa=
mily:serif;">Bernardo</span></p>=20
</div>
</div>
</div>
</div>

</div></div>
            </div>
        </div></body></html>
------=_Part_1680676_41530391.1661858324343--

--===============4072531381966279580==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline