Closed lovalery closed 5 months ago
Dear Loïc
unfortunately this is a "not so easy to figure out issue" due to the fact that link2GI was originally designed to simplify the difficult setup of GRASS
from R
overcome some minor problems of the direct linking using spgrass6
and rgrass7
under Windows. This is done by setting the missing environment parameters (depending on the Win Version) in a hidden R environment.
So actually it was *never meant to mix rgrass7::initGRASS()
with any of the link2GI
functions.
Now your issue :
sessionInfo()
output. rgrass7
and the link2GI
packages. I would like to suggest strongly not doing so . The environments are setup by the used routines in a different way and with different parameters. However the OTB related stuff of link2GI
is not touching the environment of rgrass7
. Nevertheless I am not quite sure if the error could be a side effect of the child environment ink2GI` is setting up. GRASS
and OTB
) please consider to use link2GI::linkGRASS7()
which is exactly made for this. And even more this forces you to deal in a correct way with the initialization of a GRASS
environment.
cheers ChrisEdit: Sorry, just saw it Win 8.x
while I'm dealing with this kind of thing, there hasn't been a machine with a windows 8.x installation that has worked properly or as expected, and I admit that my perhaps somewhat offensive standard message is: "Please install a clean Windows 10".
cheers Chris
Dear Chris, Thank you very much for your elaborated reply. Please find my answers to the various points you raise.
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8.1 x64 (build 9600)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgrass7_0.2-1 XML_3.99-0.3 link2GI_0.4.3 raster_3.3-7 rgeos_0.5-3 rgdal_1.5-12 sp_1.4-2
loaded via a namespace (and not attached):
[1] tidyselect_1.1.0 xfun_0.15 remotes_2.1.1 purrr_0.3.4 sf_0.9-4 lattice_0.20-41 vctrs_0.3.1 generics_0.0.2
[9] testthat_2.3.2 usethis_1.6.1 rlang_0.4.7 pkgbuild_1.0.8 e1071_1.7-3 pillar_1.4.6 glue_1.4.1 withr_2.2.0
[17] DBI_1.1.0 sessioninfo_1.1.1 lifecycle_0.2.0 stringr_1.4.0 devtools_2.3.0 codetools_0.2-16 memoise_1.1.0 knitr_1.29
[25] callr_3.4.3 ps_1.3.3 class_7.3-15 fansi_0.4.1 Rcpp_1.0.5 KernSmooth_2.23-16 backports_1.1.8 classInt_0.4-3
[33] desc_1.2.0 pkgload_1.1.0 fs_1.4.2 digest_0.6.25 stringi_1.4.6 processx_3.4.3 dplyr_1.0.0 grid_3.6.3
[41] rprojroot_1.3-2 cli_2.0.2 tools_3.6.3 magrittr_1.5 tibble_3.0.3 crayon_1.3.4 pkgconfig_2.0.3 ellipsis_0.3.1
[49] xml2_1.3.2 prettyunits_1.1.1 assertthat_0.2.1 roxygen2_7.1.1 rstudioapi_0.11 R6_2.4.1 units_0.6-7 compiler_3.6.3
Yes, I fully agree with you: it makes no sense to reset GRASS several times with the same settings. It was just to show that the reset was going well and that as soon as link2GI::linkOTB() was called the GRASS initialization crashed right after.
Yes, I agree with you and I already tried to link R and GRASS with link2GI::linkGRASS() but never succeeded (probably still linked to Windows 8.1). As an example, when I execute the simple command link2GI::findGRASS() here is the result :
> findGRASS(searchLocation = "C:")
NULL
Warning messages:
1: In system(paste0("cmd.exe /c TYPE \"", raw_GRASS[i], "\""), ignore.stdout = TRUE, :
running command 'cmd.exe /c TYPE "C:\Program Files\GRASS GIS 7.8\grass78.bat"' had status 1
2: In system(paste0("cmd.exe /c TYPE \"", raw_GRASS[i], "\""), ignore.stdout = TRUE, :
running command 'cmd.exe /c TYPE "C:\Program Files\QGIS 3.12\bin\grass78.bat"' had status 1
3: In system(paste0("cmd.exe /c TYPE \"", raw_GRASS[i], "\""), ignore.stdout = TRUE, :
running command 'cmd.exe /c TYPE "C:\Program Files\QGIS 3.12\etc\preremove\grass.bat"' had status 1
To conclude, I understand that all these problems (i.e. conflict between link2GI and rgrass7, problem in using the linkGI functions dedicated to link R and GRASS) are most probably related to Windows 8.1. For people using Windows 8.1 like me, you could, perhaps, put a warning message .
For my part I managed to fix the problem with a workaround. So, I'm not asking you to find a solution at all costs (I understand the difficulty of making all packages work perfectly in absolutely all working environments) and, therefore, you can close this thread if you wish.
Thanks again for your answer. Loïc
Dear Loïc, Sorry for this inconvenience. I will test your commands and some other checks asap under Windows 10. I'm not sure that the problems are caused by Windows 8.x and since I don't have Windows 8 available at the moment I can't test it. But from my bitter experience I can only recommend not to update Windows 8.1 to Windows 10 but to replace it with a new installation with Windows 10. If I can identify that the problems are caused by a special Windows version I will try to fix it or drop a warning. cheers Chris
Actually I am not able to reproduce the error and warning messages. However most of the stuff that happens is done with ASCII text manipulation which is strongly related to the code tables You use. Could you pls install a standalone GRASS
version in a folder without any special character and whitespace in the path etc. and than re-check?I just want to make sure that the problem is not related to the special code table that you are using on your windows system.
@gisma Dear Chris,
I'm sorry I couldn't do the test : I tried to install a second standalone version of GRASS but this is not possible because at the time of installation the first version is detected automatically and prevents the installation of the second version... and, to tell the truth, I don't really want to uninstall the first version that works : I'm afraid of doing something wrong ! (my standalone version of GRASS 7.8.3 is installed here : C:\Program Files\GRASS GIS 7.8)
Anyway, your hypothesis is probably good because when I made the link with OTB with link2GI::linkOTB(), I already had this space problem in the path. To make it work, I had to install OTB at the root (C:/OTB/) (because windows 8.1 automatically puts a space between Program and Files for its 'Program Files' directory). For OTB, this works fine, but it is not really recommended to install software directly at the root. It still remains preferable (and logical!) to install the softwares in the "Program Files" folder.
So , if you can fix this space problem (and if it's not too time-consuming !!), it would be very nice to do it, because I think it should work. Anyway, if you fix it, I will do the test immediately.
Kind regards Loïc
@gisma @rsbivand Dear Chris,
On Roger's advice, I'm contacting you to report a problem I just highlighted: there seems to be a conflict between link2GI and rgrass7.
More precisely, when I have established a link between R and GRASS with the command rgrass7::initGRASS() and then run the command link2GI::linkOTB(), the link between R and GRASS seems to be broken: if I run the command rgrass7::initGRASS() again, R returns the following error message :
This error message is accompanied by a message that opens in a popup window :
> The procedure entry point GEOSMakeValid_r could not be located in the dynamic link library C:\Program Files\GRASS GIS 7.8\extrabin\gdal300.dll
Some information about the environment : -OS: Windows 8.1 -R version 3.6.3 -All the packages are up to date -the GRASS version: stand-alone Windows GRASS 7.8.3
To be a little more concrete and to help you identify the problem, below are two tests. I am at your disposal if you would like more information or if you would like me to carry out further tests. Best regards, Loïc
The second test starting with link2GI::linkOTB() :