Linux - Ubuntu - impossible to install any package because of dependencies installation issue

Hello,

I use Linux Zorin OS (based on Ubuntu 24.10)
I'm not able anymore to install package in R Studio. It seems that dependencies are not automatically installed (the check-box install dependencies is checked). see hereinbelow, a typical erro message I've got when trying to install package Car : (it's the same for all packages installation).

could you help me ?

g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o RcppEigen.so RcppEigen.o RcppExports.o fastLm.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld : ne peut pas trouver -llapack : Aucun fichier ou dossier de ce nom
/usr/bin/ld : ne peut pas trouver -lblas : Aucun fichier ou dossier de ce nom
/usr/bin/ld : ne peut pas trouver -lgfortran : Aucun fichier ou dossier de ce nom
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10 : RcppEigen.so] Erreur 1
ERROR: compilation failed for package ‘RcppEigen’

  • removing ‘/home/mickael/R/x86_64-pc-linux-gnu-library/4.4/RcppEigen’
    Warning in install.packages :
    l'installation du package ‘RcppEigen’ a eu un statut de sortie non nul
    ERROR: dependency ‘SparseM’ is not available for package ‘quantreg’
  • removing ‘/home/mickael/R/x86_64-pc-linux-gnu-library/4.4/quantreg’
    Warning in install.packages :
    l'installation du package ‘quantreg’ a eu un statut de sortie non nul
    ERROR: dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’ are not available for package ‘lme4’
  • removing ‘/home/mickael/R/x86_64-pc-linux-gnu-library/4.4/lme4’
    Warning in install.packages :
    l'installation du package ‘lme4’ a eu un statut de sortie non nul
    ERROR: dependency ‘lme4’ is not available for package ‘pbkrtest’
  • removing ‘/home/mickael/R/x86_64-pc-linux-gnu-library/4.4/pbkrtest’
    Warning in install.packages :
    l'installation du package ‘pbkrtest’ a eu un statut de sortie non nul
    ERROR: dependencies ‘pbkrtest’, ‘quantreg’, ‘lme4’ are not available for package ‘car’
  • removing ‘/home/mickael/R/x86_64-pc-linux-gnu-library/4.4/car’
    Warning in install.packages :
    l'installation du package ‘car’ a eu un statut de sortie non nul

I ran into this recently and unfortunately did not write down the steps I used (since I was trying desperately to forget the horror show). Basically, you need to install some system packages (from the Ubuntu repositories) as prerequisites for a number of the R packages.

I'm pretty sure you are going to need the r-cran-matrix. I'm less positive about r-cran-mass, r-cran-cluster and maybe r-cran-nlme, but if you are not short on disk space it can't hurt to install them. Once you're done with the Ubunto repo, I would suggest trying to install packages flagged in the error messages as being prerequisites for others, one at a time, with a sufficient supply of adult beverages close by.

Thanks for your help.
Unfortunately it’s harder to make Rstudio working on Linux rather than on windows .
But I will try to follow jour advices , as I prefer using Linux rather than windows .

Micka

These are missing system packages, that you'll need to install. How did you install R?

Hello Gabor,

Thanks for your help.
I've installed R using the Zorin OS "applications store". Maybe I should have used a .deb package ?

Mickaël

I am not familiar with that but I would guess that ultimately it either just installs deb packages, or it uses snap. Either way, those system packages are missing and you'll need to install them, in a way that works with your R installation.

Thanks.
I will try to install the missing packages and keep you informed.

Mickaël

I think a big part of the problem is that R is not particularly clear about missing system dependencies v. missing R dependencies. When a system dependency is missing, R understandably does not specify which system library to install (which, in the case of Linux, would vary a lot from one machine to the next). It just crabs about not finding a particular C/C++ file (maybe a header, maybe a .cpp file). Left to the reader as an exercise: identify the system library needed to get that file. The user also has to know that what is typically required is a "-dev" version of the library.

Maybe Posit could design an R utility that would wade through the installer output, figure out what is missing, classify the missing bits into system v. R, and order the missing R libraries in a list/tree so that the user would know in which order to install them. :slight_smile:

❯ pak::pkg_sysreqs("tidyverse", sysreqs_platform = "ubuntu-24.04")
✔ Updated metadata database: 6.93 MB in 5 files.
✔ Updating metadata database ... done
── Install scripts ───────────────────────────────────────────── Ubuntu 24.04 ──
apt-get -y update
apt-get -y install libx11-dev libcurl4-openssl-dev libssl-dev make zlib1g-dev \
  pandoc libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev libicu-dev \
  libfontconfig1-dev libfribidi-dev libharfbuzz-dev libxml2-dev

── Packages and their system dependencies ──────────────────────────────────────
clipr       – libx11-dev
curl        – libcurl4-openssl-dev, libssl-dev
fs          – make
haven       – make, zlib1g-dev
knitr       – pandoc
openssl     – libssl-dev
ragg        – libfreetype6-dev, libjpeg-dev, libpng-dev, libtiff-dev
reprex      – pandoc
rmarkdown   – pandoc
sass        – make
stringi     – libicu-dev
systemfonts – libfontconfig1-dev, libfreetype6-dev
textshaping – libfreetype6-dev, libfribidi-dev, libharfbuzz-dev
xml2        – libxml2-dev

However OP also is also missing the BLAS and LAPACK libraries, which probably signals a broken R installation or packaging.

One way to install R is to use rig (GitHub - r-lib/rig: The R Installation Manager), and then all system dependencies are installed automatically, but rig does not support Ubuntu 24.10, it only supports the LTS releases.

3 Likes

Thanks. These are useful options for the future.

Thanks to both of you for your support.

Rig doesn't work on my Zorin OS linux distribution (even if it's based on Ubuntu 22.04 LTS, rig send the requested using "zorin os" as linux distribution that is not supported by rig).
However it's good to know that Rig exists.

I've solved my problem by installing the missing system library mentioned by Gabor.

Once again thanks to you.

Mickaël

rig does support derivative distros, but you need to set the

RIG_PLATFORM="ubuntu-24.04"

env var, so rig knows which OS its needs to download packages for.

But again, we only build R for Ubuntu LTS versions, and not for the other releases. Posit Package Manager also only builds binary packages for Ubuntu LTS releases, so it is really beneficial to use an LTS release, if you can do that.

My experience is that our LTS packages do not work on the non-LTS releases.

Thanks Gabor .

Could you tell me where do I need to change the rig_platform env variable ? Using command line ?

Thanks in advance .

Mickaël

See e.g. here: Errors using rig with linux distribution pop_os · Issue #206 · r-lib/rig · GitHub

For those who came here with the same problem, just to be clear, to set environmental variable RIG_PLATFORM to 'ubuntu-22.04':

  1. Add export RIG_PLATFORM="ubuntu-22.04 to the file ~./profile.
  2. Save, exit the file and runs source ~/.profile.
  3. check now if echo $RIG_PLATFORM now shows ubuntu-22.04 instead of nothing, and rig system detect-platform now shows Distribution: ubuntu instead of Distribution: pop.

thanks Gabor,
could you just tell me where to locate the file ~./profile ?

thanks

Mickaël

Thats a full path, ~ stands for the current user's home directory:

root@711a4f84b753:~# cd ~
root@711a4f84b753:~# pwd
/root
root@711a4f84b753:~# ls ~
R

SO many thanks Gabor.
it works . my zorin OS 17 distro is based on ubuntu LTS 22.04 .
so it works great !!!

1 Like

Awesome, thanks for reporting back!

1 Like