opengeos / whiteboxR

WhiteboxTools R Frontend
https://whiteboxR.gishub.org
Other
168 stars 30 forks source link

Download URL for wbt_install on Apple M series is incorrect #114

Closed DOSull closed 11 months ago

DOSull commented 11 months ago

When I run wbt_install() on an Apple Macbook M2, I get

> wbt_install()
Performing one-time download of WhiteboxTools binary from
     https://www.whiteboxgeo.com/WBT_Darwin/WhiteboxTools_darwin_darwin_m_series.zip 
(This could take a few minutes, please be patient...)
trying URL 'https://www.whiteboxgeo.com/WBT_Darwin/WhiteboxTools_darwin_darwin_m_series.zip'
trying URL 'https://www.whiteboxgeo.com/WBT_Darwin/WhiteboxTools_darwin_darwin_m_series.zip'
Unable to download by any method!

The repetition of _darwin in the zip file URL is clearly incorrect. I have been able to get WBT working, but have ended up putting the binary in a non-standard location, and it would be nice if the standard installation procedure worked properly on this platform!

DOSull commented 11 months ago

It looks like the offending code is lines 558-60 in wbt.R where

if (Sys.info()["machine"] == "arm64") {
  suffix <- "darwin_m_series"
}

shoud be

if (Sys.info()["machine"] == "arm64") {
  suffix <- "m_series"
}
brownag commented 11 months ago

Thanks for catching this! It is great Whitebox offers Apple M binaries pre-compiled--a relatively new feature.

As you found the "darwin_" prefix was duplicated in the code that creates the URL for arm64 platform. That is certainly my mistake. My apologies. I do not have access to any modern Apple hardware so this is the first I know that this newer install code has actually been tested on M series. GitHub actions macOS is x86_64.

I have corrected the URL on GitHub, if you don't mind please do install with remotes::install_github("opengeos/whiteboxR") to confirm it works for you.

Also note I think you can use the standard installation method (with the current CRAN version) by specifying the platform argument to wbt_install() as follows: wbt_install(platform="darwin_m_series"). You can't currently specify operating system via argument, so it won't work on Windows or Linux, but I think it should work for you.

DOSull commented 11 months ago

Removing and reinstalling with the remotes::install_github(...) method as you suggested works! Thanks for the quick fix. Note that I haven't tried the platform option in the standard CRAN install.