noricia
noricia

Reputation: 47

R unable to access index for repository when installing packages

I'm trying to install: ClimateR package from github using

devtools::install_github("mikejohnson51/climateR")
#Warning: unable to access index for repository #https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.1:
#  cannot open URL 'https://cran.rstudio.com/bin/macosx/big-sur-#arm64/contrib/4.1/PACKAGES'
#Packages which are only available in source form, and may need #compilation of C/C++/Fortran:
#  ‘RNetCDF’ ‘terra’
#"Do you want to attempt to install these from sources?
#(Yes/no/cancel)" 

After I say "YES" It downloads until it gives me the error:

configure: error: netcdf.h was not compiled - defining CPPFLAGS may help
ERROR: configuration failed for package ‘RNetCDF’

Dependencies ‘ncmeta’, ‘RNetCDF’ are not available for package ‘climateR’

I downloaded homebrew and installed netcdf and gdal using brew in the terminal because a solution suggested this but still the same errors.

I'm encountering errors also when trying to install terra or RNetCDF, When I try to install terra, I get:

install.packages("terra")
Warning in install.packages :
  unable to access index for repository https://cloud.r-project.org/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://cloud.r-project.org/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Package which is only available in source form, and may need compilation of C/C++/Fortran:
  ‘terra’
Do you want to attempt to install these from sources? (Yes/no/cancel) options(repos = "https://cran.rstudio.com")
Error in install.packages : Unrecognized response “options(repos = "https://cran.rstudio.com")”

I am unable to open that URL, it tells me "The requested URL /bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES was not found on this server."

My internet connection is stable so it shouldn't have to do with that.

Upvotes: 0

Views: 576

Answers (1)

Robert Hijmans
Robert Hijmans

Reputation: 46991

You are using an old version of R (4.1) for which the compiled package is, apparently, not available. Start by updating R to the current version (4.3.1). Then the rest will probably work.

Upvotes: 0

Related Questions