R load error - libproj.so.13: cannot open shared object file: No such file or directory
Asked Answered
B

2

7

I am trying to install CRANs population genetics package hierfstat; however the following error with libproj.so.13 is printed:

> install.packages("hierfstat")
Installing package into ‘/home/ecoevo/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/hierfstat_0.04-22.tar.gz'
Content type 'application/x-gzip' length 460778 bytes (449 KB)
==================================================
downloaded 449 KB

* installing *source* package ‘hierfstat’ ...
** package ‘hierfstat’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/ecoevo/R/x86_64-pc-linux-gnu-library/3.6/sf/libs/sf.so':
  libproj.so.13: cannot open shared object file: No such file or directory
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘hierfstat’
* removing ‘/home/ecoevo/R/x86_64-pc-linux-gnu-library/3.6/hierfstat’
* restoring previous ‘/home/ecoevo/R/x86_64-pc-linux-gnu-library/3.6/hierfstat’
Warning in install.packages :
  installation of package ‘hierfstat’ had non-zero exit status

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

Any suggestions on how to fix this error? I am working on Ubuntu-20.04

Bandmaster answered 18/5, 2020 at 17:45 Comment(2)
You may need to install the libproj-dev OS package (that's the name for ubuntu, not sure what other distros use). (I don't know, just an idea.)Bodnar
I had the same issue - Ubuntu 20.04, R upgraded to 4.0.1 recently. Installing system package libproj-dev did not help (sudo apt install -y libproj-dev), but re-installing R package proj4 did resolve the issue: install.packages("proj4"). R pkg proj4 must have remembered the previous PROJ4 headers, which have been upgraded (to a new version under a new file path) since.Graveclothes
G
4

I was also facing same issue with ubuntu 20.04. In my case, I had extend my LD library path. In bash

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

In tcsh

setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH\:/lib
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH\:/usr/lib
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH\:/usr/local/lib

Afterwards, you could already see that shared libraries can now be found if

/usr/local/bin/proj

does not result in any error.

Gigi answered 21/10, 2020 at 13:57 Comment(0)
H
1

I had the same issue with package "stars" while working on a shared computer. Other packages I was able to install, but not this one. The issue was solved by running R as sudo. From Terminal:

sudo R                                # start R session as sudo
install.packages("<package_name>")    # install your package
q()                                   # quit R session 
Hamlett answered 17/12, 2020 at 11:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.