I just installed R on my PC. I installed raster package but when I do library(raster) it returns me that:

Errore: caricamento pacchetto o namespace fallito per ‘raster’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 namespace ‘terra’ 1.4-22 già caricato, ma >= 1.5.12 è richiesto

What's the problem?

3 Answers 3


The easiest way to deal with this temporary problem (CRAN not compiling terra) is to install the development version of terra like this:

install.packages('terra', repos='https://rspatial.r-universe.dev')

And then install raster


  • I did it, but still: clc00 <- raster("CLC2000ACC_V2018_20.tif") Errore in raster("CLC2000ACC_V2018_20.tif") : non trovo la funzione "raster" Commented Jan 31, 2022 at 13:52
  • first do library(raster) ? Commented Jan 31, 2022 at 17:20

While installing package raster, when R prompts whether you would like to compile and install package from source, you have to click yes.

The raster package depends on another package named terra. This package can be installed in two ways: from a pre-compiled binary or from its source code. The pre-compiled binary is an older version compared to the source code. You can see the following in your R console, after you agree to yes in the prompt:

      There is a binary version available but the source version is later:
        binary source needs_compilation
  terra 1.4-22 1.5-12              TRUE

Package raster needs the newer version 1.5-12 of the terra package, as you can see in the error message. So, you need to install from source.


sudo apt-get update sudo apt-get install gdal-bin sudo apt-get install libgdal-dev Then install.packages(“raster”)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.