0

I am trying to run 'whitebox' packages in R.

To get started, I follow the steps in the link: https://github.com/giswqs/whiteboxR

install.packages("whitebox")
whitebox::install_whitebox()

Console:

------------------------------------------------------------------------
Could not find WhiteboxTools!
------------------------------------------------------------------------

Your next step is to download and install the WhiteboxTools binary:
    > whitebox::install_whitebox()

If you have WhiteboxTools installed already run `wbt_init(exe_path=...)`': 
    > wbt_init(exe_path='/home/user/path/to/whitebox_tools')

For whitebox package documentation, ask for help:
    > ??whitebox

For more information visit https://giswqs.github.io/whiteboxR/

------------------------------------------------------------------------

Performing one-time download of WhiteboxTools binary from
     https://www.whiteboxgeo.com/WBT_Windows/WhiteboxTools_win_amd64.zip 
(This could take a few minutes, please be patient...)
trying URL 'https://www.whiteboxgeo.com/WBT_Windows/WhiteboxTools_win_amd64.zip'
Content type 'application/zip' length 15383844 bytes (14.7 MB)
downloaded 14.7 MB

WhiteboxTools binary is located here:  C:/Users/frsu0056/OneDrive - Umeå universitet/Documents/R/win-library/4.1/whitebox/WBT/whitebox_tools.exe 
You can now start using whitebox
    library(whitebox)
    wbt_version()

After downloading i run:

library(whitebox)
if(wbt_init()==TRUE){print("all good")}#confirms if the whitebox_tools.exe exists in,'C:/Users/frsu0056/OneDrive - Umeå universitet/Documents/R/win-library/4.1/whitebox/WBT/whitebox_tools.exe'.

console:

[1] "all good"

Now, if I try to run any function in the whitebox package, it returns an odd error message

for example

wbt_version()

returns:

Error : 
Error running WhiteboxTools
  whitebox.exe_path: "C:/Users/frsu0056/OneDrive - Umeå universitet/Documents/R/win-library/4.1/whitebox/WBT/whitebox_tools.exe"; File exists? TRUE
  Arguments: --version

Error in system(exeargs, intern = TRUE, ignore.stderr = ignore.stderr, : '"C:/Users/frsu0056/OneDrive - Umeå universitet/Documents/R/win-library/4.1/whitebox/WBT/whitebox_tools.exe"' not found

Yet, the wbt_init() returns TRUE so the file exists in the given directory. Nevertheless, the wbt_version() function can not find it.

And so the story goes for any function in the whitebox package. It just can't find the .exe file yet the file exists in the folder where it is supposed to be.

Anyone else get the same problem running this? And what could possibly be wrong here?

Below is the .exe file resting in the directory. picture showing .exe file in the directory

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Just a guess: the path includes "OneDrive". Maybe you cannot run/execute programs on OneDrive? and also there are non-ascii characters in the path. That also could be a problem. – Micha Mar 10 '22 at 09:21
  • I tried to run the install on a friends computer and it worked, so it seem that you are absolutely right. If I place the 'whitebox' folder somewhere in C (outside of OneDrive) and run wbt_init(exe.path="C:/testfolder/whitebox/WTB/whitebox_tools.exe") it finally works. – fredrik.sundberg Mar 10 '22 at 09:50

1 Answers1

0

The problem with whitebox in my experience is that it cannot decode spaces. I don't think the problem is the one drive folder per se, just that there are spaces in the file path. I would suggest not having your packages installed in a one drive folder or any other folder where the path has spaces. To change the folder where your libraries are installed, refer to the solution: Change R default library path using .libPaths in Rprofile.site fails to work

Andrew
  • 105
  • 8