[GRASS-user] Rscript error when using v.class.mlR

ok, I misunderstood. I'm getting a similar response.
C:\Users\haarlooj\Documents>Rscript -e "sessionInfo()"
'Rscript' is not recognized as an internal or external command,
operable program or batch file.

the reason is that the Rbatch-files from OSGeo4W version 1 (https://download.osgeo.org/osgeo4w/v1/x86_64/release/rbatch/) are not yet included in OSGeo4W version 2 (compare https://download.osgeo.org/osgeo4w/v2/x86_64/release/).

winGRASS 8 is based upon OSGeo4W version 2.

kind regards
Helmut

Thank you Helmut.
Is it best to go back to the previous versions for the meantime?

On Mon, Jul 17, 2023 at 4:20 PM Helmut Kudrnovsky <hellik@web.de> wrote:

ok, I misunderstood. I’m getting a similar response.
C:\Users\haarlooj\Documents>Rscript -e “sessionInfo()”
‘Rscript’ is not recognized as an internal or external command,
operable program or batch file.

the reason is that the Rbatch-files from OSGeo4W version 1 (https://download.osgeo.org/osgeo4w/v1/x86_64/release/rbatch/) are not yet included in OSGeo4W version 2 (compare https://download.osgeo.org/osgeo4w/v2/x86_64/release/).

winGRASS 8 is based upon OSGeo4W version 2.

kind regards
Helmut

Is it best to go back to the previous versions for the meantime?

yes, that would be an option.

are you using OSGeo4W or standalone winGRASS?

these R-batch-files are living also in the source:

https://github.com/OSGeo/grass/tree/main/mswindows/external/rbatch

and are integrated into extrabin-folder of the winGRASS standalone installer.

could you try the standalone installer? which version are you using?

kind regards
Helmut

Is it best to go back to the previous versions for the meantime?

yes, that would be an option.

are you using OSGeo4W or standalone winGRASS?

these R-batch-files are living also in the source:

https://github.com/OSGeo/grass/tree/main/mswindows/external/rbatch

and are integrated into extrabin-folder of the winGRASS standalone installer.

could you try the standalone installer? which version are you using?

see also discussion at:

https://github.com/OSGeo/grass/discussions/3091

I am using standalone winGRASS, but installed it with OSGeo4W because I also use QGIS.
I was using version 8.2.1, but went back to 7.8.5 and OSGeo4W v1.
With R4.3.1 getting other errors, and with R4.0 there was also trouble finding the R script? (FileNotFoundError: [WinError 2] The system cannot find the file specified.)
I checked the input text files. These don’t have NA values.
I am doing a test classification with limited training-data.

Msg when using R4.3.1
Running R now. Following output is R output.
During startup - Warning messages:
1: Setting LC_COLLATE=en_US.cp1252 failed
2: Setting LC_CTYPE=en_US.cp1252 failed
3: Setting LC_MONETARY=en_US.cp1252 failed
4: Setting LC_TIME=en_US.cp1252 failed
Loading required package: ggplot2
Loading required package: lattice
Warning messages:
1: package ‘caret’ was built under R version 4.3.1
2: package ‘ggplot2’ was built under R version 4.3.1
Warning message:
package ‘data.table’ was built under R version 4.3.1
Something is wrong; all the Accuracy metric values are missing:
Accuracy Kappa
Min. : NA Min. : NA
1st Qu.: NA 1st Qu.: NA
Median : NA Median : NA
Mean :NaN Mean :NaN
3rd Qu.: NA 3rd Qu.: NA
Max. : NA Max. : NA
NA’s :4 NA’s :4
Error: Stopping
In addition: There were 33 warnings (use warnings() to see them)
Execution halted
ERROR: There was an error in the execution of the R script.
Please check the R output.

On Tue, Jul 18, 2023 at 3:43 PM Helmut Kudrnovsky <hellik@web.de> wrote:

Is it best to go back to the previous versions for the meantime?

yes, that would be an option.

are you using OSGeo4W or standalone winGRASS?

these R-batch-files are living also in the source:

https://github.com/OSGeo/grass/tree/main/mswindows/external/rbatch

and are integrated into extrabin-folder of the winGRASS standalone installer.

could you try the standalone installer? which version are you using?

see also discussion at:

https://github.com/OSGeo/grass/discussions/3091

I am using standalone winGRASS, but installed it with OSGeo4W because I also use QGIS.

I don't understand this. How do you install standalone winGRASS with OSGeo4W? But that's another question.

Jürgen re-packaged now winGRASS 8.3.0 in OSGeo4W version 2 including the Rbatch-files.

have a look at https://github.com/ggrothendieck/batchfiles/blob/master/R.bat#L520 and following code lines.

the relevant one is https://github.com/ggrothendieck/batchfiles/blob/master/R.bat#L532

"echo path - Add R_TOOLS, R_MIKTEX ^& R_PATH to path for this cmd line session (0)"

just tried here in OSGeo4W version 2 with re-packaged winGRASS 8.3.0:

* starting a GRASS session
* typing into the windows console: R path => this adds temporarily the path to R to %PATH%
* typing into the windows console: RScript -e "sessionInfo()" => outputs all necessary infos if R is correctly found (as Micha suggested)

when temporarily the path to R is added to %PATH% within the winGRASS session, try v.class.mlR.

Kind regards
Helmut

Thank you Helmut,
R is not found:
‘R’ is not recognized as an internal or external command, operable program or batch file.
Currently looking for information online about what to do.

I also installed the winGRASS 8.3 via/in OSGeo4W v2, but now there is also a problem with g.extension to add v.class.mlR. I tried it on my laptop and work computer. Same problem.

Exception in thread
Thread-14
:
Traceback (most recent call last):
File “C:\OSGeo4W\apps\Python39\lib\threading.py”, line
954, in _bootstrap_inner

self.run()
File “C:\OSGeo4W\apps\grass\grass83\gui\wxpython\core\gthr
ead.py”, line 154, in __run

self.__run_backup()
File “C:\OSGeo4W\apps\grass\grass83\gui\wxpython\core\gthr
ead.py”, line 117, in run

ret = vars()[“callable”](*args, **kwds)
File “C:\OSGeo4W\apps\grass\grass83\gui\wxpython\modules\e
xtensions.py”, line 369, in Load

raise GException((“Unable to load extensions. %s”) % msg)
core.gcmd
.
GException
:
Unable to load extensions. Traceback (most recent call
last):
File “C:\OSGeo4W\apps\grass\grass83\scripts[g.extension.py](http://g.extension.py)”,
line 2855, in
sys.exit(main())
File “C:\OSGeo4W\apps\grass\grass83\scripts[g.extension.py](http://g.extension.py)”,
line 2803, in main
xmlurl = resolve_xmlurl_prefix(original_url, source=source)
File “C:\OSGeo4W\apps\grass\grass83\scripts[g.extension.py](http://g.extension.py)”,
line 2492, in resolve_xmlurl_prefix
version_branch = get_version_branch(VERSION[0])
File “C:\OSGeo4W\apps\grass\grass83\scripts[g.extension.py](http://g.extension.py)”,
line 507, in get_version_branch
branch = gs.Popen(
File “C:\OSGeo4W\apps\grass\grass83\etc\python\grass\script
core.py”, line 55, in init
raise OSError(
(“Cannot find the executable
{0}”).format(args[0]))
OSError: Cannot find the executable git

On Wed, Jul 19, 2023 at 3:02 PM Helmut Kudrnovsky <hellik@web.de> wrote:

I am using standalone winGRASS, but installed it with OSGeo4W because I also use QGIS.

I don’t understand this. How do you install standalone winGRASS with OSGeo4W? But that’s another question.

Jürgen re-packaged now winGRASS 8.3.0 in OSGeo4W version 2 including the Rbatch-files.

have a look at https://github.com/ggrothendieck/batchfiles/blob/master/R.bat#L520 and following code lines.

the relevant one is https://github.com/ggrothendieck/batchfiles/blob/master/R.bat#L532

“echo path - Add R_TOOLS, R_MIKTEX ^& R_PATH to path for this cmd line session (0)”

just tried here in OSGeo4W version 2 with re-packaged winGRASS 8.3.0:

  • starting a GRASS session
  • typing into the windows console: R path => this adds temporarily the path to R to %PATH%
  • typing into the windows console: RScript -e “sessionInfo()” => outputs all necessary infos if R is correctly found (as Micha suggested)

when temporarily the path to R is added to %PATH% within the winGRASS session, try v.class.mlR.

Kind regards
Helmut

Hi Jamille,

On Thu, 20. Jul 2023 at 17:03:24 -0300, Jamille Haarloo wrote:

Thank you Helmut,
R is not found:
'R' is not recognized as an internal or external command, operable program
or batch file.
Currently looking for information online about what to do.

I also installed the winGRASS 8.3 via/in OSGeo4W v2, but now there is also
a problem with g.extension to add v.class.mlR. I tried it on my laptop and
work computer. Same problem.

R and git are not included in OSGeo4W. So you have to install them separately.
The rbatch files call that external R, but AFAIK there is no way yet in GRASS
to put the external git into GRASS path. And the rbatch files are only in
GRASS path. So you cannot run them from the OSGeo4W shell directly, but from
within GRASS (gui or text).

Jürgen

--
Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31
Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50
Software Engineer D-26506 Norden https://www.norbit.de
QGIS release manager (PSC) Germany IRC: jef on Libera|OFTC