Saturday, September 3, 2022

[SOLVED] error in library.dynam(lib, package, package.lib) shared ovject <library_name>.so not found

Issue

Using VirtualBox with Ubuntu 20LTS, and attempting to install and load R packages, getting the error:

error in library.dynam(lib, package, package.lib)
shared object <library_name>.so not found

Where <library_name> can be any of multiply libraries:

  • rlang
  • digest
  • fs
  • fansi

So the error looks like this:

error in library.dynam(lib, package, package.lib)
shared object digest.so not found

So far, uninstalled and reinstalled the packages with install.packages() and with sudo apt-get install r-cran-.

Currently cannot use devtools to install because it too fails to load with require(devtools) saying shared object fs.so (was) not found.

Please help


Solution

Please step back a second and start from the top with a clean installation of R. The do

sudo apt-get install r-cran-digest

and library(digest) will work. I do not recall if fs and fansi are available for 20.04 so you will have to come to terms with source installation but even that should be easy of you have r-base-dev installed.

Now, we generally strongly recommend you start from the README for Ubuntu at the CRAN repo and enable that repo. Then you get R 4.2.1. If you read the part on '5000+ CRAN Packages' you can equally easily get CRAN binaries for 5000+ packages, including fs and fansi as r-cran-* binaries from the c2d4u.team repo.

Better still, I now support a project I call r2u which has all of CRAN for Ubuntu 20.04 and 22.04. The installation is simple in five quick steps in a documented script (and detailed at the README of r2u. You then can do

  install.packages(c("digest", "fs", "fansi"))

in R and get binaries in seconds as the gif below shows.

enter image description here



Answered By - Dirk Eddelbuettel
Answer Checked By - Terry (WPSolving Volunteer)