r-spatial / mapview

Interactive viewing of spatial data in R
https://r-spatial.github.io/mapview/
GNU General Public License v3.0
516 stars 91 forks source link

no package called ‘terra’ #464

Closed Sirhurryup closed 9 months ago

Sirhurryup commented 9 months ago

After installing and loading mapview in workspace, I receive the following error message: Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘terra’.

Before posting, I searched stackoverflow and other spaces to solve this problem. [https://stackoverflow.com/questions/72837662/package-installation-error-with-mapview-package]. I tried the recommended solutions. Even unloaded and reloaded the terra packages.

Here is original code: addresses_geocoded1 %>% st_as_sf(coords = c("long", "lat"), crs = 4326) %>% mapview(). Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘terra’.

Then I tried install.packages('terra'). This started:

trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/terra_1.7-55.tgz'
Content type 'application/x-gzip' length 101829667 bytes (97.1 MB)
===================================
downloaded 68.2 MB
Warning in install.packages :
  downloaded length 0 != reported length 0
Warning in install.packages :
  URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/terra_1.7-55.tgz': Timeout of 60 seconds was reached
Error in download.file(url, destfile, method, mode = "wb", ...) : download from 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/terra_1.7-55.tgz' failed
Warning in install.packages : download of package ‘terra’ failed

Any suggestions on how to overcome this hurdle?

tim-salabim commented 9 months ago

Seems like something went wrong during the download of terra. I'd just retry installing it. Once terra is installed, mapview should work (assuming all other required packages are available)

Sirhurryup commented 9 months ago

@tim-salabim Thanks. I tried again with the following error below. I closed R. I started fresh install after checking all packages were updated. I still get the previous error that lead me to post the issue. Also, used the remotes to install the developer from github and this times out. Can you offer any other dependencies I might be missing?

install.packages("terra") trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/terra_1.7-55.tgz' Content type 'application/x-gzip' length 101829667 bytes (97.1 MB)

downloaded 68.7 MB

Warning in install.packages : downloaded length 0 != reported length 0 Warning in install.packages : URL 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/terra_1.7-55.tgz': Timeout of 60 seconds was reached Error in download.file(url, destfile, method, mode = "wb", ...) : download from 'https://cran.rstudio.com/bin/macosx/big-sur-x86_64/contrib/4.3/terra_1.7-55.tgz' failed Warning in install.packages : download of package ‘terra’ failed

edzer commented 9 months ago

download timeout: use

options(timeout = 600)

and try reinstall.

Sirhurryup commented 9 months ago

@edzer

That solution solved problem. Many thanks.