robertspierre
robertspierre

Reputation: 4431

Error installing rgdal: API to be used not found

I have Fedora Workstation 34.

I have installed gdal-devel rpm on my system:

sudo dnf install gdal-devel

Now I am trying to install the R rgdal package.

But the installation fails with the following error message:

configure: API to be used as yet undetermined, searching ...
configure: error: API to be used not found
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/raffaele/R/x86_64-redhat-linux-gnu-library/4.0/rgdal’

The downloaded source packages are in
    ‘/tmp/RtmpZRbq1a/downloaded_packages’


✔ Package 'rgdal' successfully installed.
Warning message:
In utils::install.packages("rgdal", repos = "https://cran.rstudio.com/") :
  installation of package ‘rgdal’ had non-zero exit status

Please note that in the above the

Package 'rgdal' successfully installed.

is wrong.

In particular it looks like it can't find an API.

How can I fix this problem and install the rgdal R package?

Upvotes: 2

Views: 1720

Answers (3)

sbkm
sbkm

Reputation: 142

The above instructions are for Debian/Ubuntu or similar. Dependencies in Linux need to be installed separately as indicated in the CRAN for rgdal. On Fedora use

sudo dnf install gdal-devel proj-devel

Not that proj-devel is necessary to prevent the error "configure: error: API to be used not found". After which in R you can use install.packages("rgdal"). Using the package manager is also a good solution.

Upvotes: 4

robertspierre
robertspierre

Reputation: 4431

I discovered you can install the binaries directly from the package manager

sudo dnf install R-rgdal

Upvotes: 1

TMmn
TMmn

Reputation: 54

Based on the instructions by dncgst, I would suggest first installing the packages libgdal-dev and libproj-dev:

sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev

Upvotes: 1

Related Questions