user4545132132
user4545132132

Reputation: 41

How to fix 'libproj not found in standard or given locations' error in r

I'm trying to install the 'agricolae' package on R, but I get an error saying

    configure: error: libproj not found in standard or given locations.
    ERROR: configuration failed for package ‘sf’
    * removing ‘/R/x86_64-pc-linux-gnu-library/3.6/sf’
    Warning in install.packages :
      installation of package ‘sf’ had non-zero exit status
    ERROR: dependency ‘sf’ is not available for package ‘spdep’
    * removing ‘/R/x86_64-pc-linux-gnu-library/3.6/spdep’
    Warning in install.packages :
      installation of package ‘spdep’ had non-zero exit status
    ERROR: dependency ‘spdep’ is not available for package ‘agricolae’
    * removing ‘/R/x86_64-pc-linux-gnu-library/3.6/agricolae’
    Warning in install.packages :
      installation of package ‘agricolae’ had non-zero exit status

I recently upgraded to Ubuntu 18.04.2 and R version 3.6.0 (2019-04-26) -- "Planting of a Tree" and that's when the problems started.

When I do

    $ sudo apt-get install -y libproj-dev

I get:

    libproj-dev is already the newest version (5.2.0-1~bionic0).

Upvotes: 4

Views: 4977

Answers (1)

IRTFM
IRTFM

Reputation: 263451

The error says that package 'sf' is not available for dependency 'spdep'. So you should be attempting to install pkg 'sf'. (I'm on the same OS as you and pkg:agricolae installed without problem just now. I have a more complete set of spatial R and system packages than you do.)

Edit: There have been reports that it was necessary in addressing this problem to create an environment link to the location of your libraries:

$ export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib 

(From: https://stat.ethz.ch/pipermail/r-sig-geo/2018-August/026740.html which in turn linked to https://gis.stackexchange.com/questions/157059/repairing-broken-gdal-and-proj-4-on-ubuntu, which has so further debugging options mentioned.)

Upvotes: 2

Related Questions